diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEvent.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEvent.java index afa8218a0..79059c454 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEvent.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilEvent.java @@ -1,6 +1,10 @@ package mineplex.core.common.util; +import org.bukkit.entity.LivingEntity; +import org.bukkit.entity.Projectile; import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityDamageByEntityEvent; +import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.player.PlayerInteractEvent; public class UtilEvent @@ -37,4 +41,32 @@ public class UtilEvent return false; } + + public static LivingEntity GetDamagerEntity(EntityDamageEvent event, boolean ranged) + { + if (!(event instanceof EntityDamageByEntityEvent)) + return null; + + EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent)event; + + //Get Damager + if (eventEE.getDamager() instanceof LivingEntity) + return (LivingEntity)eventEE.getDamager(); + + if (!ranged) + return null; + + if (!(eventEE.getDamager() instanceof Projectile)) + return null; + + Projectile projectile = (Projectile)eventEE.getDamager(); + + if (projectile.getShooter() == null) + return null; + + if (!(projectile.getShooter() instanceof LivingEntity)) + return null; + + return (LivingEntity)projectile.getShooter(); + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/antistack/AntiStack.java b/Plugins/Mineplex.Core/src/mineplex/core/antistack/AntiStack.java index 3a939b047..c5bcd132f 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/antistack/AntiStack.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/antistack/AntiStack.java @@ -13,6 +13,8 @@ import org.bukkit.plugin.java.JavaPlugin; public class AntiStack extends MiniPlugin { + private boolean _enabled = true; + public AntiStack(JavaPlugin plugin) { super("AntiStack", plugin); @@ -21,6 +23,9 @@ public class AntiStack extends MiniPlugin @EventHandler (priority=EventPriority.HIGHEST) public void ItemSpawn(ItemSpawnEvent event) { + if (!_enabled) + return; + if (event.isCancelled()) return; @@ -43,6 +48,9 @@ public class AntiStack extends MiniPlugin @EventHandler (priority=EventPriority.HIGHEST) public void PlayerPickup(PlayerPickupItemEvent event) { + if (!_enabled) + return; + if (event.isCancelled()) return; @@ -62,6 +70,9 @@ public class AntiStack extends MiniPlugin @EventHandler public void HopperPickup(InventoryPickupItemEvent event) { + if (!_enabled) + return; + if (event.isCancelled()) return; @@ -77,4 +88,9 @@ public class AntiStack extends MiniPlugin //Set Name ((CraftItemStack)item.getItemStack()).getHandle().c(name); } + + public void SetEnabled(boolean var) + { + _enabled = var; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/creature/Creature.java b/Plugins/Mineplex.Core/src/mineplex/core/creature/Creature.java index 037517069..46f70a59b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/creature/Creature.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/creature/Creature.java @@ -246,7 +246,7 @@ public class Creature extends MiniPlugin for (Player cur : players.keySet()) { Vector vec = UtilAlg.getTrajectory(event.getEntity().getLocation(), cur.getLocation()); - UtilAction.velocity(cur, vec, 1 + 3 * players.get(cur), false, 0, 1 + 1 * (players.get(cur)), 3, true); + UtilAction.velocity(cur, vec, 1 + 2 * players.get(cur), false, 0, 0.5 + 1 * (players.get(cur)), 2, true); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java index 96454360c..aa84fcc4b 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java @@ -393,6 +393,9 @@ public class ItemStackFactory extends MiniPlugin public void StatsArmorRename(ItemStack item, int damage) { + if (!_customNames) + return; + if (item == null) return; @@ -407,8 +410,11 @@ public class ItemStackFactory extends MiniPlugin } @EventHandler(priority = EventPriority.MONITOR) - public void StatsBowShoot(BlockBreakEvent event) + public void StatsBlockMined(BlockBreakEvent event) { + if (!_customNames) + return; + if (event.isCancelled()) return; @@ -427,6 +433,9 @@ public class ItemStackFactory extends MiniPlugin @EventHandler(priority = EventPriority.HIGHEST) public void StatsKillMob(EntityDeathEvent event) { + if (!_customNames) + return; + if (!(event.getEntity() instanceof Monster)) return; @@ -454,6 +463,9 @@ public class ItemStackFactory extends MiniPlugin @EventHandler(priority = EventPriority.MONITOR) public void StatsBowShoot(EntityShootBowEvent event) { + if (!_customNames) + return; + if (event.isCancelled()) return; @@ -470,7 +482,7 @@ public class ItemStackFactory extends MiniPlugin @EventHandler public void RenameSpawn(ItemSpawnEvent event) - { + { if (!_customNames) return; @@ -720,7 +732,6 @@ public class ItemStackFactory extends MiniPlugin return CreateStack(type.getId(), data, amount, damage, name, lore, null); } - //XXX public ItemStack CreateStack(Material type, byte data, int amount, String name, List lore, String owner) { return CreateStack(type.getId(), data, amount, (short)0, name, lore, owner); @@ -951,4 +962,14 @@ public class ItemStackFactory extends MiniPlugin stack.setItemMeta(meta); } + + public void SetUseCustomNames(boolean var) + { + _customNames = var; + } + + public void SetCustomNameFormat(String format) + { + _nameFormat = format; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java b/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java index 8083547af..68d972a8c 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/teleport/Teleport.java @@ -67,7 +67,7 @@ public class Teleport extends MiniPlugin LinkedList listA = new LinkedList(); //ALL - if (from.equals("%ALL%") && _clientManager.Get(caller).GetRank().Has(caller, Rank.OWNER, false)) + if (from.equals("%ALL%")) for (Player cur : UtilServer.getPlayers()) listA.add(cur); //Normal diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java index 6910840e1..c41272881 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/combat/CombatManager.java @@ -8,9 +8,11 @@ import net.minecraft.server.v1_6_R2.ItemStack; import org.bukkit.craftbukkit.v1_6_R2.inventory.CraftItemStack; import org.bukkit.entity.Arrow; import org.bukkit.entity.Fireball; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.plugin.java.JavaPlugin; @@ -23,6 +25,7 @@ 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.UtilTime; @@ -57,6 +60,131 @@ public class CombatManager extends MiniPlugin return _combatClients.get(name); } + + //This is a backup, for when CustomDamageEvent is disabled (manually) + @EventHandler(priority = EventPriority.MONITOR) + public void AddAttack(EntityDamageEvent event) + { + if (event.isCancelled()) + return; + + if (event.getEntity() == null || !(event.getEntity() instanceof Player)) + return; + + Player damagee = (Player)event.getEntity(); + + LivingEntity damagerEnt = UtilEvent.GetDamagerEntity(event, true); + + //Attacked by Entity + if (damagerEnt != null) + { + if (damagerEnt instanceof Player) + Get((Player)damagerEnt).LastCombat = System.currentTimeMillis(); + + Get(damagee).Attacked( + UtilEnt.getName(damagerEnt), + event.getDamage(), damagerEnt, + event.getCause() + ""); + } + // Damager is WORLD + else + { + DamageCause cause = event.getCause(); + + String source = "?"; + String reason = "-"; + + if (cause == DamageCause.BLOCK_EXPLOSION) + { + source = "Explosion"; + reason = "-"; + } else if (cause == DamageCause.CONTACT) + { + source = "Cactus"; + reason = "-"; + } else if (cause == DamageCause.CUSTOM) + { + source = "Custom"; + reason = "-"; + } else if (cause == DamageCause.DROWNING) + { + source = "Water"; + reason = "-"; + } else if (cause == DamageCause.ENTITY_ATTACK) + { + source = "Entity"; + reason = "Attack"; + } else if (cause == DamageCause.ENTITY_EXPLOSION) + { + source = "Explosion"; + reason = "-"; + } else if (cause == DamageCause.FALL) + { + source = "Fall"; + reason = "-"; + } else if (cause == DamageCause.FALLING_BLOCK) + { + source = "Falling Block"; + reason = "-"; + } else if (cause == DamageCause.FIRE) + { + source = "Fire"; + reason = "-"; + } else if (cause == DamageCause.FIRE_TICK) + { + source = "Fire"; + reason = "-"; + } else if (cause == DamageCause.LAVA) + { + source = "Lava"; + reason = "-"; + } else if (cause == DamageCause.LIGHTNING) + { + source = "Lightning"; + reason = "-"; + } else if (cause == DamageCause.MAGIC) + { + source = "Magic"; + reason = "-"; + } else if (cause == DamageCause.MELTING) + { + source = "Melting"; + reason = "-"; + } else if (cause == DamageCause.POISON) + { + source = "Poison"; + reason = "-"; + } else if (cause == DamageCause.PROJECTILE) + { + source = "Projectile"; + reason = "-"; + } else if (cause == DamageCause.STARVATION) + { + source = "Starvation"; + reason = "-"; + } else if (cause == DamageCause.SUFFOCATION) + { + source = "Suffocation"; + reason = "-"; + } else if (cause == DamageCause.SUICIDE) + { + source = "Suicide"; + reason = "-"; + } else if (cause == DamageCause.VOID) + { + source = "Void"; + reason = "-"; + } else if (cause == DamageCause.WITHER) + { + source = "Wither"; + reason = "-"; + } + + Get(damagee).Attacked(source, + event.getDamage(), null, reason); + } + + } public void AddAttack(CustomDamageEvent event) { diff --git a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java index dddb96e56..fa81e73fe 100644 --- a/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java +++ b/Plugins/Mineplex.Minecraft.Game.Core/src/mineplex/minecraft/game/core/damage/DamageManager.java @@ -9,6 +9,7 @@ import mineplex.core.common.util.F; import mineplex.core.common.util.UtilAction; import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; @@ -48,6 +49,8 @@ public class DamageManager extends MiniPlugin public boolean UseSimpleWeaponDamage = false; public boolean DisableDamageChanges = false; + private boolean _enabled = true; + public DamageManager(JavaPlugin plugin, CombatManager combatManager, NpcManager npcManager, DisguiseManager disguiseManager) { super("Damage Manager", plugin); @@ -73,6 +76,9 @@ public class DamageManager extends MiniPlugin @EventHandler(priority = EventPriority.HIGHEST) public void StartDamageEvent(EntityDamageEvent event) { + if (!_enabled) + return; + boolean preCancel = false; if (event.isCancelled()) preCancel = true; @@ -82,7 +88,7 @@ public class DamageManager extends MiniPlugin //Get Data LivingEntity damagee = GetDamageeEntity(event); - LivingEntity damager = GetDamagerEntity(event, true); + LivingEntity damager = UtilEvent.GetDamagerEntity(event, true); Projectile projectile = GetProjectile(event); if (projectile instanceof Fish) @@ -95,8 +101,6 @@ public class DamageManager extends MiniPlugin //New Event NewDamageEvent(damagee, damager, projectile, event.getCause(), event.getDamage(), true, false, false, null, null, preCancel); - //event.setDamage(0); - //if (GoldPower(damager)) event.setCancelled(true); } @@ -506,34 +510,6 @@ public class DamageManager extends MiniPlugin event.setDamage(damage); } - private LivingEntity GetDamagerEntity(EntityDamageEvent event, boolean ranged) - { - if (!(event instanceof EntityDamageByEntityEvent)) - return null; - - EntityDamageByEntityEvent eventEE = (EntityDamageByEntityEvent)event; - - //Get Damager - if (eventEE.getDamager() instanceof LivingEntity) - return (LivingEntity)eventEE.getDamager(); - - if (!ranged) - return null; - - if (!(eventEE.getDamager() instanceof Projectile)) - return null; - - Projectile projectile = (Projectile)eventEE.getDamager(); - - if (projectile.getShooter() == null) - return null; - - if (!(projectile.getShooter() instanceof LivingEntity)) - return null; - - return (LivingEntity)projectile.getShooter(); - } - private LivingEntity GetDamageeEntity(EntityDamageEvent event) { if (event.getEntity() instanceof LivingEntity) @@ -554,4 +530,9 @@ public class DamageManager extends MiniPlugin return null; } + + public void SetEnabled(boolean var) + { + _enabled = var; + } } 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 0301b86ed..e8e4d7af4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/Arcade.java @@ -104,7 +104,7 @@ public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin new MessageManager(this, _clientManager); - new AntiStack(this); + AntiStack antistack = new AntiStack(this); GetCreature(); GetSpawn(); @@ -118,7 +118,7 @@ public class Arcade extends JavaPlugin implements INautilusPlugin, IPlugin _damageManager = new DamageManager(this, new CombatManager(this), new NpcManager(this, GetCreature()), disguiseManager); //Arcade Manager - _gameManager = new ArcadeManager(this, ReadServerConfig(), _clientManager, _donationManager, conditionManager, _damageManager, disguiseManager, GetCreature(), GetBlood(), packetHandler); + _gameManager = new ArcadeManager(this, ReadServerConfig(), _clientManager, _donationManager, conditionManager, _damageManager, disguiseManager, GetCreature(), GetBlood(), antistack, packetHandler); //Unreferenced Modules //new AntiStack(); 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 9a73ff3f6..ca442cf48 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -37,6 +37,7 @@ import mineplex.core.MiniPlugin; import mineplex.core.itemstack.ItemStackFactory; import me.chiss.Core.Modules.Blood; import mineplex.core.account.CoreClientManager; +import mineplex.core.antistack.AntiStack; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.chat.Chat; import mineplex.core.common.Rank; @@ -52,6 +53,7 @@ import mineplex.core.projectile.ProjectileManager; public class ArcadeManager extends MiniPlugin implements IRelation { //Modules + private AntiStack _antistack; private BlockRestore _blockRestore; private Blood _blood; private Chat _chat; @@ -83,13 +85,15 @@ public class ArcadeManager extends MiniPlugin implements IRelation //Games private Game _game; - public ArcadeManager(JavaPlugin plugin, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DamageManager damageManager, DisguiseManager disguiseManager, Creature creature, Blood blood, PacketHandler packetHandler) + public ArcadeManager(JavaPlugin plugin, GameServerConfig serverConfig, CoreClientManager clientManager, DonationManager donationManager, ConditionManager conditionManager, DamageManager damageManager, DisguiseManager disguiseManager, Creature creature, Blood blood, AntiStack antistack, PacketHandler packetHandler) { super("Game Manager", plugin); _serverConfig = serverConfig; //Modules + _antistack = antistack; + _blockRestore = new BlockRestore(plugin); _blood = blood; @@ -162,6 +166,11 @@ public class ArcadeManager extends MiniPlugin implements IRelation return GetServerConfig().GameList; } + public AntiStack GetAntiStack() + { + return _antistack; + } + public Blood GetBlood() { return _blood; @@ -195,7 +204,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation public DisguiseManager GetDisguise() { return _disguiseManager; - } + } public DamageManager GetDamage() { @@ -456,12 +465,19 @@ public class ArcadeManager extends MiniPlugin implements IRelation player.setGameMode(GameMode.SURVIVAL); player.setAllowFlight(false); UtilInv.Clear(player); + player.setFoodLevel(20); + player.setSaturation(3f); + player.setExhaustion(0f); + player.setHealth(20); + player.setFireTicks(0); player.setFallDistance(0); + player.setLevel(0); player.setExp(0f); + ((CraftPlayer)player).getHandle().spectating = false; ((CraftPlayer)player).getHandle().m = true; 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 903c319c5..c7ecbf304 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 @@ -58,6 +58,8 @@ public class GameTeam private HashSet _kitRestrict = new HashSet(); private int _spawnDistance = 0; + + private boolean _visible = true; public GameTeam(String name, ChatColor color, ArrayList spawns) { @@ -295,4 +297,14 @@ public class GameTeam _players.put(player, state); } } + + public void SetVisible(boolean b) + { + _visible = b; + } + + public boolean GetVisible() + { + return _visible; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java index 3aea47a80..df99307fc 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/Barbarians.java @@ -1,13 +1,28 @@ package nautilus.game.arcade.game.games.barbarians; +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.entity.PlayerDeathEvent; + +import mineplex.core.common.util.UtilServer; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; +import nautilus.game.arcade.events.GameStateChangeEvent; +import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.SoloGame; import nautilus.game.arcade.game.games.barbarians.kits.*; import nautilus.game.arcade.kit.Kit; public class Barbarians extends SoloGame { + private GameTeam _barbs; + private GameTeam _pigs; + public Barbarians(ArcadeManager manager) { super(manager, GameType.Barbarians, @@ -16,7 +31,8 @@ public class Barbarians extends SoloGame { new KitBrute(manager), new KitArcher(manager), - new KitBomber(manager) + new KitBomber(manager), + new KitPig(manager) }, new String[] @@ -25,8 +41,11 @@ public class Barbarians extends SoloGame "Wooden blocks are breakable.", "Last player alive wins!" }); + + this.DeathOut = false; this.HungerSet = 20; this.DamageTeamSelf = true; + this.CompassEnabled = true; this.BlockBreakAllow.add(5); this.BlockBreakAllow.add(17); @@ -47,4 +66,111 @@ public class Barbarians extends SoloGame this.BlockBreakAllow.add(135); this.BlockBreakAllow.add(136); } + + @Override + @EventHandler + public void CustomTeamGeneration(GameStateChangeEvent event) + { + if (event.GetState() != GameState.Recruit) + return; + + _barbs = this.GetTeamList().get(0); + _barbs.SetName("Barbarians"); + + //Undead Team + _pigs = new GameTeam("Dead", ChatColor.RED, _barbs.GetSpawns()); + GetTeamList().add(_pigs); + _pigs.SetVisible(false); + + RestrictKits(); + } + + @Override + public GameTeam ChooseTeam(Player player) + { + return _barbs; + } + + @EventHandler + public void PlayerDeath(PlayerDeathEvent event) + { + if (_barbs.HasPlayer(event.getEntity())) + SetChaser(event.getEntity()); + } + + public void SetChaser(Player player) + { + if (!GetPlaces().contains(player)) + GetPlaces().add(0, player); + + SetPlayerTeam(player, _pigs); + + //Kit + Kit newKit = GetKits()[3]; + + SetKit(player, newKit, false); + newKit.ApplyKit(player); + + //Refresh + for (Player other : UtilServer.getPlayers()) + { + other.hidePlayer(player); + other.showPlayer(player); + } + } + + @Override + public void EndCheck() + { + if (!IsLive()) + return; + + if (_barbs.GetPlayers(true).size() <= 1) + { + if (_barbs.GetPlayers(true).size() == 1) + GetPlaces().add(0, GetPlayers(true).get(0)); + + if (GetPlaces().size() >= 1) + AddGems(GetPlaces().get(0), 15, "1st Place", false); + + if (GetPlaces().size() >= 2) + AddGems(GetPlaces().get(1), 10, "2nd Place", false); + + if (GetPlaces().size() >= 3) + AddGems(GetPlaces().get(2), 5, "3rd Place", false); + + for (Player player : GetPlayers(false)) + if (player.isOnline()) + AddGems(player, 10, "Participation", false); + + SetState(GameState.End); + AnnounceEnd(GetPlaces()); + } + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (_barbs == null || _pigs == null) + return; + + GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(_barbs.GetColor() + _barbs.GetName())).setScore(_barbs.GetPlayers(true).size()); + GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(_pigs.GetColor() + _pigs.GetName())).setScore(_pigs.GetPlayers(true).size()); + } + + @Override + public boolean CanJoinTeam(GameTeam team) + { + return (team.GetColor() != ChatColor.RED); + } + + @EventHandler + public void BlockBreak(BlockDamageEvent event) + { + event.setInstaBreak(true); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java index 704ff2fd6..5f2af8663 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/DeathTag.java @@ -58,6 +58,8 @@ public class DeathTag extends SoloGame this.HungerSet = 20; this.CompassEnabled = true; + + this.PrepareFreeze = false; } @Override @@ -165,7 +167,7 @@ public class DeathTag extends SoloGame if (event.getType() != UpdateType.FAST) return; - int req = 1 + _runners.GetPlayers(true).size()/20; + int req = 1 + (int) ((System.currentTimeMillis() - GetStateTime()) / 30000); while (_chasers.GetPlayers(true).size() < req && _runners.GetPlayers(true).size() > 0) { @@ -216,6 +218,7 @@ public class DeathTag extends SoloGame } UtilPlayer.message(player, C.cRed + C.Bold + "You are now a Chaser!"); + UtilPlayer.message(player, C.cRed + C.Bold + "KILL THEM ALL!!!!!!"); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java index 4dd5750be..c8ab1c8f6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/DragonEscape.java @@ -20,10 +20,12 @@ import org.bukkit.util.Vector; import mineplex.core.common.util.C; import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilTime; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import nautilus.game.arcade.ArcadeManager; @@ -37,6 +39,8 @@ public class DragonEscape extends SoloGame { private ArrayList _ranks = new ArrayList(); private ArrayList _lastScoreboard = new ArrayList(); + + private NautHashMap _warpTime = new NautHashMap(); private Location _dragon; private ArrayList _waypoints; @@ -175,9 +179,12 @@ public class DragonEscape extends SoloGame //Shortcut if (postNode - preNode >= 2) { - score.Player.damage(500); - UtilPlayer.message(player, F.main("Game", "You were killed for trying to cheat!")); - return false; + if (!_warpTime.containsKey(score.Player) || UtilTime.elapsed(_warpTime.get(score.Player), 1000)) + { + score.Player.damage(500); + UtilPlayer.message(player, F.main("Game", "You were killed for trying to cheat!")); + return false; + } } //Finish @@ -210,8 +217,6 @@ public class DragonEscape extends SoloGame return score; } - - public int GetWaypointIndex(Location loc) { int best = -1; @@ -281,7 +286,7 @@ public class DragonEscape extends SoloGame _lastScoreboard.add(out); - GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore((int)score.Score); //16-i + GetObjectiveSide().getScore(Bukkit.getOfflinePlayer(out)).setScore(16-i); } } @@ -413,6 +418,9 @@ public class DragonEscape extends SoloGame player.setVelocity(new Vector(0,0,0)); player.setFallDistance(0); + //Record + _warpTime.put(player, System.currentTimeMillis()); + //Inform UtilPlayer.message(player, F.main("Game", "You warped to " + F.name(target.getName()) + "!")); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitWarper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitWarper.java index 72cb245ba..54b75e9a6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitWarper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragonescape/kits/KitWarper.java @@ -20,7 +20,7 @@ public class KitWarper extends Kit new String[] { - "Use your Enderpearl to instantlyy warp", + "Use your Enderpearl to instantly warp", "to the player in front of you!" }, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java index 22bc16261..426362971 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/MilkCow.java @@ -26,6 +26,7 @@ import org.bukkit.scoreboard.Objective; import mineplex.core.common.util.F; import mineplex.core.common.util.UtilGear; 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.updater.UpdateType; @@ -317,7 +318,7 @@ public class MilkCow extends SoloGame SetScore(event.getPlayer(), GetScore(event.getPlayer())+1); event.getPlayer().getWorld().playSound(event.getPlayer().getLocation(), Sound.BURP, 2f, 1f); - Manager.GetCondition().Factory().Regen("Drink Milk", event.getPlayer(), event.getPlayer(), 6, 1, false, false, false); + UtilPlayer.health(event.getPlayer(), 8); } public void SetScore(Player player, double level) @@ -331,7 +332,7 @@ public class MilkCow extends SoloGame { score.Score = level; - if (level == 6) + if (level == 15) End(); return; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitCow.java index e273f7558..161488ef7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitCow.java @@ -20,7 +20,7 @@ public class KitCow extends SmashKit { public KitCow(ArcadeManager manager) { - super(manager, "The Disgusting Cow", KitAvailability.Blue, + super(manager, "The Angry Cow", KitAvailability.Free, new String[] { @@ -28,7 +28,7 @@ public class KitCow extends SmashKit new Perk[] { - new PerkDamageSet(4), + new PerkDamageSet(5), new PerkKnockbackMultiplier(4), new PerkCharge(), new PerkCowBomb(), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitFarmerJump.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitFarmerJump.java index 29d4d81aa..d7d6adc5b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitFarmerJump.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/milkcow/kits/KitFarmerJump.java @@ -30,7 +30,7 @@ public class KitFarmerJump extends Kit new PerkDoubleJump("Double Jump", 1, 0.8, false) }, - EntityType.VILLAGER, + EntityType.ZOMBIE, new ItemStack(Material.IRON_HOE)); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java index d2c665dae..2107b3e8d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitKnight.java @@ -122,7 +122,8 @@ public class KitKnight extends SmashKit _horses.add(horse); _mounts.put(player, horse); - + + /* final Player fPlayer = player; Manager.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() @@ -132,6 +133,7 @@ public class KitKnight extends SmashKit horse.setPassenger(fPlayer); } }, 1); + */ } @EventHandler diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java index 73517f49f..239d6a6c0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/TurfForts.java @@ -18,10 +18,10 @@ import org.bukkit.entity.Entity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityShootBowEvent; import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; -import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.scoreboard.Score; import mineplex.core.common.util.C; @@ -66,7 +66,7 @@ public class TurfForts extends TeamGame private long _fightTime = 90000; private boolean _fight = false; private int _lines = 0; - + private HashMap _enemyTurf = new HashMap(); public TurfForts(ArcadeManager manager) @@ -134,7 +134,7 @@ public class TurfForts extends TeamGame if (event.GetLog().GetKiller() == null) return; - + Player killed = (Player)event.GetEvent().getEntity(); Player killer = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); @@ -143,10 +143,10 @@ public class TurfForts extends TeamGame if (GetTeam(killer) == null) return; - + if (GetTeam(killed) == null) return; - + if (GetTeam(killer).equals(GetTeam(killed))) return; @@ -221,16 +221,12 @@ public class TurfForts extends TeamGame } @EventHandler - public void BowCancel(PlayerInteractEvent event) + public void BowCancel(EntityShootBowEvent event) { if (!_fight) { - if (UtilGear.isMat(event.getPlayer().getItemInHand(), Material.BOW)) - { - event.setCancelled(true); - UtilPlayer.message(event.getPlayer(), F.main("Game", "You cannot attack during Build Time!")); - } - + event.setCancelled(true); + UtilPlayer.message(event.getEntity(), F.main("Game", "You cannot attack during Build Time!")); } } @@ -320,7 +316,7 @@ public class TurfForts extends TeamGame block.breakNaturally(); } - + arrow.remove(); } catch (Exception e) @@ -338,22 +334,22 @@ public class TurfForts extends TeamGame { event.SetCancelled("Build Time"); } - + Player damager = event.GetDamagerPlayer(true); if (damager == null) return; if (event.GetCause() == DamageCause.PROJECTILE) { event.AddMod("Turf Forts", "Nullify", -event.GetDamageInitial(), false); - + if (GetKit(damager).GetName().contains("Shredder")) { event.SetCancelled("Shredder"); - + Manager.GetDamage().NewDamageEvent(event.GetDamageeEntity(), damager, null, DamageCause.CUSTOM, 6, true, true, false, damager.getName(), "Barrage"); - + return; } else @@ -364,7 +360,7 @@ public class TurfForts extends TeamGame else if (event.GetCause() == DamageCause.ENTITY_ATTACK) { event.AddMod("Turf Forts", "Nullify", -event.GetDamageInitial(), false); - + if (UtilGear.isMat(damager.getItemInHand(), Material.IRON_SWORD)) { event.AddMod("Turf Forts", "One Hit Kill", 12, false); @@ -381,7 +377,7 @@ public class TurfForts extends TeamGame { if (GetState() != GameState.Live) return; - + //2x Initial Build if (_phaseTime == 0) _phaseTime = System.currentTimeMillis() + _buildTime; @@ -393,41 +389,41 @@ public class TurfForts extends TeamGame if (!_fight) { time = _buildTime - (System.currentTimeMillis() - _phaseTime); - + long displayTime = Math.max(0, time); GetObjectiveSide().setDisplayName(ChatColor.WHITE + C.Bold + "Build Time " + C.cGreen + C.Bold+ UtilTime.MakeStr(displayTime)); - + if (time <= 0) { _fight = true; _lines++; - + Announce(" "); Announce(C.cWhite + C.Bold + "1 Kill" + C.cWhite + C.Bold + " = " + C.cWhite + C.Bold + GetLinesPerKill() + " Turf Lines"); Announce(C.cWhite + C.Bold + "90 Seconds of " + C.cYellow + C.Bold + "Combat Time" + C.cWhite + C.Bold + " has begun!"); Announce(" "); - + _phaseTime = System.currentTimeMillis(); } } - + else { time = _fightTime - (System.currentTimeMillis() - _phaseTime); - + long displayTime = Math.max(0, time); GetObjectiveSide().setDisplayName(ChatColor.WHITE + C.Bold + "Combat Time " + C.cGreen + C.Bold+ UtilTime.MakeStr(displayTime)); - + if (time <= 0) { _fight = false; - + Announce(" "); Announce(C.cWhite + C.Bold + "20 Seconds of " + C.cGreen + C.Bold + "Build Time" + C.cWhite + C.Bold + " has begun!"); Announce(" "); - + _phaseTime = System.currentTimeMillis(); - + for (GameTeam team : GetTeamList()) { for (Player player : team.GetPlayers(true)) @@ -498,7 +494,7 @@ public class TurfForts extends TeamGame { _enemyTurf.remove(event.getEntity()); } - + @EventHandler public void Territory(UpdateEvent event) { @@ -513,8 +509,11 @@ public class TurfForts extends TeamGame for (Player player : team.GetPlayers(true)) { Block block = player.getLocation().getBlock().getRelative(BlockFace.DOWN); - while (block.getTypeId() == 0) + while (block.getTypeId() == 0 && block.getY() > 0) block = block.getRelative(BlockFace.DOWN); + + if (block.getTypeId() == 0) + continue; byte data = block.getData(); @@ -522,25 +521,25 @@ public class TurfForts extends TeamGame if (_enemyTurf.containsKey(player)) { int time = (int) ((System.currentTimeMillis() - _enemyTurf.get(player))/2500); - + if (time > 0) Manager.GetCondition().Factory().Slow("Infiltrator Slow", player, player, 0.9, time-1, false, false, false, false); } - + //On Enemy Turf if ((team.GetColor() == ChatColor.RED && data == 3) || (team.GetColor() == ChatColor.AQUA && data == 14)) { - + //Infiltrate if (_fight && GetKit(player) != null && GetKit(player).GetName().contains("Infil")) { - + if (!_enemyTurf.containsKey(player)) _enemyTurf.put(player, System.currentTimeMillis()); continue; } - + if (Recharge.Instance.use(player, "Territory Knockback", 2000, false)) { UtilAction.velocity(player, UtilAlg.getTrajectory2d(player.getLocation(), team.GetSpawn()), 2, false, 0, 0.8, 1, true); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitInfiltrator.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitInfiltrator.java index deec1b998..98cf43420 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitInfiltrator.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitInfiltrator.java @@ -26,7 +26,7 @@ public class KitInfiltrator extends Kit new Perk[] { new PerkConstructor("Constructor", 4, 4, Material.WOOL, "Wool", false), - new PerkFletcher(12, 1, false), + new PerkFletcher(8, 1, false), }, EntityType.ZOMBIE, new ItemStack(Material.IRON_SWORD)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitMarksman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitMarksman.java index 1abe72fae..6fed1155b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitMarksman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitMarksman.java @@ -25,7 +25,7 @@ public class KitMarksman extends Kit new Perk[] { new PerkConstructor("Constructor", 4, 8, Material.WOOL, "Wool", false), - new PerkFletcher(4, 2, false), + new PerkFletcher(2, 2, false), }, EntityType.ZOMBIE, diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java index 64a05e19d..d58aeb25d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/uhc/UHC.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.uhc; import java.util.ArrayList; +import java.util.HashSet; import java.util.Iterator; import org.bukkit.ChatColor; @@ -10,6 +11,7 @@ import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.World.Environment; import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_6_R2.entity.CraftPlayer; import org.bukkit.enchantments.Enchantment; import org.bukkit.entity.Entity; @@ -21,6 +23,7 @@ import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.block.BlockBreakEvent; import org.bukkit.event.block.BlockPlaceEvent; +import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.entity.EntityDeathEvent; import org.bukkit.event.entity.EntityRegainHealthEvent; import org.bukkit.event.entity.PlayerDeathEvent; @@ -28,7 +31,6 @@ import org.bukkit.event.entity.EntityRegainHealthEvent.RegainReason; import org.bukkit.event.inventory.PrepareItemCraftEvent; import org.bukkit.event.player.PlayerCommandPreprocessEvent; import org.bukkit.event.player.PlayerItemConsumeEvent; -import org.bukkit.event.player.PlayerJoinEvent; import org.bukkit.event.player.PlayerKickEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.event.player.PlayerMoveEvent; @@ -45,6 +47,8 @@ import mineplex.core.common.util.C; import mineplex.core.common.util.F; import mineplex.core.common.util.MapUtil; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEvent; import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilMath; @@ -62,7 +66,6 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.core.combat.CombatLog; import mineplex.minecraft.game.core.combat.event.CombatDeathEvent; import mineplex.minecraft.game.core.condition.Condition.ConditionType; -import mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeFormat; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; @@ -103,11 +106,6 @@ public class UHC extends TeamGame "Last team alive wins!" }); - // Flags - this.DamagePvP = false; - this.DamageSelf = true; - this.DamageTeamSelf = true; - this.DeathDropItems = true; this.ItemDrop = true; @@ -146,8 +144,8 @@ public class UHC extends TeamGame //Disable Custom Mob Drops (and EXP Disable) Manager.GetCreature().SetDisableCustomDrops(true); - //Disable Weapon Damage Mods - Manager.GetDamage().DisableDamageChanges = true; + //Disable Anti-Stack + Manager.GetAntiStack().SetEnabled(false); } @@ -189,11 +187,11 @@ public class UHC extends TeamGame else if (_gameMinutes == 18) { Announce(ChatColor.WHITE + C.Bold + "PvP enabled in 2 minutes."); - } + } else if (_gameMinutes == 19) { Announce(ChatColor.WHITE + C.Bold + "PvP enabled in 1 minutes."); - } + } else if (_gameMinutes == 20) { Announce(ChatColor.WHITE + C.Bold + "PvP enabled! 20 minutes have passed."); @@ -214,6 +212,9 @@ public class UHC extends TeamGame if (event.GetState() != GameState.Prepare) return; + //Disable Damage Manager + Manager.GetDamage().SetEnabled(false); + WorldData.World.setTime(2000); //Kill Mobs @@ -233,19 +234,12 @@ public class UHC extends TeamGame { Manager.GetCondition().Factory().Blind("Start Blind", player, player, 8, 1, false, false, false); Manager.GetCondition().Factory().Slow("Start Slow", player, player, 8, 4, false, false, false, false); - - player.setSaturation(0f); + + player.setSaturation(3f); player.setExhaustion(0f); } } - - @EventHandler - public void PlayerJoinMap(PlayerJoinEvent event) - { - //event.getPlayer().getInventory().remove(Material.MAP); - //event.getPlayer().getInventory().addItem(_map.GetMap()); - } - + @EventHandler public void WorldBoundaryCheck(PlayerMoveEvent event) { @@ -363,7 +357,7 @@ public class UHC extends TeamGame for (GameTeam team : GetTeamList()) { - Location loc = WorldData.World.getHighestBlockAt(-1000 + UtilMath.r(2000), -1000 + UtilMath.r(2000)).getLocation(); + Location loc = GetRandomSpawn(null); //Ensure 250 Blocks between Teams while (true) @@ -385,20 +379,58 @@ public class UHC extends TeamGame if (!clash) break; - loc = WorldData.World.getHighestBlockAt(-1000 + UtilMath.r(2000), -1000 + UtilMath.r(2000)).getLocation(); + loc = GetRandomSpawn(null); } team.GetSpawns().add(loc); while (team.GetSpawns().size() < 5) { - Location other = WorldData.World.getHighestBlockAt(loc.getBlockX() - 5 + UtilMath.r(10), loc.getBlockZ() - 5 + UtilMath.r(10)).getLocation(); + Location other = GetRandomSpawn(loc); team.GetSpawns().add(other); } } } + public Location GetRandomSpawn(Location around) + { + HashSet ignore = new HashSet(); + ignore.add(Material.LEAVES); + + Location loc = null; + + while (loc == null) + { + Block block = null; + + //Get Team Location + if (around == null) + { + block = UtilBlock.getHighest(WorldData.World, -900 + UtilMath.r(1800), -900 + UtilMath.r(1800), ignore); + } + //Get Radius Location + else + { + block = UtilBlock.getHighest(WorldData.World, around.getBlockX() - 5 + UtilMath.r(10), around.getBlockZ() - 5 + UtilMath.r(10), ignore); + } + + //Check Validity + + //Liquid + if (block.getRelative(BlockFace.DOWN).isLiquid()) + continue; + + //Suffocated + if (block.getTypeId() != 0 || block.getRelative(BlockFace.UP).getTypeId() != 0) + continue; + + loc = block.getLocation().add(0.5, 0, 0.5); + } + + return loc; + } + @EventHandler public void GhastDrops(EntityDeathEvent event) { @@ -421,7 +453,9 @@ public class UHC extends TeamGame event.getDrops().add(ItemStackFactory.Instance.CreateStack(Material.SKULL, (byte)3, 1, team.GetColor() + player.getName() + "'s Head")); //Lightning - player.getWorld().strikeLightningEffect(player.getLocation()); + Location loc = player.getLocation(); + loc.setY(-150); + player.getWorld().strikeLightningEffect(loc); //Time _deathTime.put(player.getName(), System.currentTimeMillis()); @@ -529,25 +563,61 @@ public class UHC extends TeamGame } @EventHandler - public void DamageRecord(CustomDamageEvent event) + public void DamageRecord(EntityDamageEvent event) { - if (event.IsCancelled()) + if (event.isCancelled()) return; - Player damagee = event.GetDamageePlayer(); - if (damagee == null) return; + LivingEntity damagerEnt = UtilEvent.GetDamagerEntity(event, true); + + //No PvP + if (_gameMinutes < 20) + { + if (damagerEnt != null && damagerEnt instanceof Player && event.getEntity() instanceof Player) + { + event.setCancelled(true); + return; + } + } + + //Damager + if (damagerEnt != null) + { + if (damagerEnt instanceof Player) + { + Player damager = (Player)damagerEnt; - Player damager = event.GetDamagerPlayer(true); - if (damager == null) return; + //Damager Not Alive + if (!IsAlive(damager)) + { + event.setCancelled(true); + return; + } + //Damager Alive + else + { + _combatTime.put(damager, System.currentTimeMillis()); + } + } + } - _combatTime.put(damagee, System.currentTimeMillis()); - _combatTime.put(damager, System.currentTimeMillis()); - } + //Damagee + if (event.getEntity() instanceof Player) + { + Player damagee = (Player)event.getEntity(); - @EventHandler(priority = EventPriority.LOWEST) - public void DamageToLevelDisable(CustomDamageEvent event) - { - event.SetDamageToLevel(false); + //Damagee Not Alive + if (!IsAlive(damagee)) + { + event.setCancelled(true); + return; + } + //Damagee Alive + else if (damagerEnt != null && damagerEnt instanceof Player) + { + _combatTime.put(damagee, System.currentTimeMillis()); + } + } } @EventHandler @@ -878,7 +948,7 @@ public class UHC extends TeamGame Manager.GetDisguise().disguise(disguise); player.sendMessage("You are a Wither Skeleton!"); } - + UtilInv.Clear(player); UtilInv.insert(player, new ItemStack(Material.IRON_SWORD)); @@ -888,34 +958,40 @@ public class UHC extends TeamGame } @EventHandler - public void SpecialDamage(CustomDamageEvent event) + public void SpecialDamage(EntityDamageEvent event) { - if (event.IsCancelled()) + if (event.isCancelled()) return; - - Player player = event.GetDamageePlayer(); - if (player != null) + + //Damager + LivingEntity damagerEnt = UtilEvent.GetDamagerEntity(event, true); + if (damagerEnt != null) { - GameTeam team = GetTeam(player); - if (team != null) + if (damagerEnt instanceof Player) { - if (team.GetColor() == ChatColor.DARK_GRAY) + Player damager = (Player)damagerEnt; + + GameTeam team = GetTeam(damager); + + if (team != null && team.GetColor() == ChatColor.DARK_GRAY) { - event.SetCancelled("Special Cancel"); + event.setCancelled(true); + return; } } } - player = event.GetDamagerPlayer(true); - if (player != null) + //Damagee + if (event.getEntity() instanceof Player) { - GameTeam team = GetTeam(player); - if (team != null) + Player damagee = (Player)event.getEntity(); + + GameTeam team = GetTeam(damagee); + + if (team != null && team.GetColor() == ChatColor.DARK_GRAY) { - if (team.GetColor() == ChatColor.DARK_GRAY) - { - event.SetCancelled("Special Cancel"); - } + event.setCancelled(true); + return; } } } @@ -980,7 +1056,7 @@ public class UHC extends TeamGame player.setPlayerListName(" "); else player.setPlayerListName(" "); - + continue; } @@ -993,17 +1069,22 @@ public class UHC extends TeamGame if (((int)player.getHealth()) % 2 == 0) health += (int)(player.getHealth()/2); else - health += player.getHealth()/2d; + health += UtilMath.trim(1, player.getHealth()/2d); String name = team.GetColor() + player.getName(); - int length = 16 - (name.length() + health.length()); - if (length < 0) + try { - name = name.substring(0, name.length() + length); + while (name.length() + health.length() > 16) + name = name.substring(0, name.length()-1); + + player.setPlayerListName(name + health); + } + catch (Exception e) + { + System.out.println("TAB NAME: " + name + health); + e.printStackTrace(); } - - player.setPlayerListName(name + health); } } @@ -1071,7 +1152,7 @@ public class UHC extends TeamGame UtilPlayer.message(player, ArcadeFormat.Line); } } - + @Override public void AnnounceEnd(GameTeam team) { @@ -1140,6 +1221,18 @@ public class UHC extends TeamGame if (team.GetColor() != ChatColor.DARK_GRAY) if (team.GetPlayers(true).size() > 0) teamsAlive.add(team); + /* + { + for (Player player : team.GetPlayers(true)) + { + if (player.isOnline()) + { + teamsAlive.add(team); + break; + } + } + } + */ if (teamsAlive.size() <= 1) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCharge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCharge.java index 363b0ef9a..1f4242400 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCharge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCharge.java @@ -43,7 +43,7 @@ public class PerkCharge extends Perk if (!Kit.HasKit(player)) continue; - player.getWorld().playSound(player.getLocation(), Sound.COW_WALK, 2f, 1f); + player.getWorld().playSound(player.getLocation(), Sound.COW_WALK, 0.8f, 1f); Manager.GetCondition().Factory().Speed(GetName(), player, player, 0.9, 2, false, false, false); @@ -63,7 +63,7 @@ public class PerkCharge extends Perk //Damage Event Manager.GetDamage().NewDamageEvent(cur, player, null, - DamageCause.CUSTOM, 2, false, false, false, + DamageCause.CUSTOM, 3, false, false, false, player.getName(), GetName()); //Velocity diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java index 0ed10886d..9fdb2124f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkCreeperExplode.java @@ -9,6 +9,7 @@ import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.block.Action; +import org.bukkit.event.entity.PlayerDeathEvent; import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.util.Vector; @@ -191,4 +192,15 @@ public class PerkCreeperExplode extends Perk event.AddKnockback(GetName(), 2.5); } + + @EventHandler + public void Death(PlayerDeathEvent event) + { + if (!Kit.HasKit(event.getEntity())) + return; + + _active.remove(event.getEntity()); + + DecreaseSize(event.getEntity()); + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java index 590f4256b..652ea2a0a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameCreationManager.java @@ -139,9 +139,10 @@ public class GameCreationManager implements Listener private void CreateGame(GameType gameType) { - //Reset Damage Changes + //Reset Changes Manager.GetDamage().DisableDamageChanges = false; Manager.GetCreature().SetDisableCustomDrops(false); + Manager.GetDamage().SetEnabled(true); HashMap pastTeams = null; 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 8ea86657e..0a8dc6735 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 @@ -166,12 +166,8 @@ public class GameFlagManager implements Listener if (game == null || !game.IsAlive(player) || game.GetState() != GameState.Live) { - if (player.isOp() && player.getGameMode() == GameMode.CREATIVE) - { - return; - } - event.setCancelled(true); + return; } @@ -658,7 +654,7 @@ public class GameFlagManager implements Listener player.getLocation().getZ() < game.WorldData.MinZ || ((player.getLocation().getY() > game.WorldData.MaxY || player.getLocation().getY() < game.WorldData.MinY) && game.IsAlive(player))) - { + { if (!Manager.IsAlive(player)) { player.teleport(game.GetSpectatorLocation()); 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 8f998eab6..c3ce8037d 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 @@ -304,8 +304,12 @@ public class GameLobbyManager implements IPacketRunnable, Listener if (game.GetKits().length > 1 || game.GetType() != GameType.UHC) { //Display - ArrayList teams = game.GetTeamList(); - + ArrayList teams = new ArrayList(); + + for (GameTeam team : game.GetTeamList()) + if (team.GetVisible()) + teams.add(team); + //Positions double space = 6; double offset = (teams.size()-1)*space/2d; @@ -410,12 +414,8 @@ public class GameLobbyManager implements IPacketRunnable, Listener _teams.put(ent, new LobbyEnt(ent, entLoc, teamsB.get(i))); } } - - } - - CreateScoreboards(); }