diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java index ccf503360..fd8ff6eb3 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilPlayer.java @@ -4,7 +4,9 @@ import java.util.Collection; import java.util.HashMap; import java.util.LinkedList; import java.util.List; +import java.util.UUID; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Location; @@ -59,6 +61,11 @@ public class UtilPlayer return null; } + public static Player searchExact(UUID uuid) + { + return UtilServer.getServer().getPlayer(uuid); + } + public static String searchCollection(Player caller, String player, Collection coll, String collName, boolean inform) { LinkedList matchList = new LinkedList(); diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextBottom.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextBottom.java index 485eee9d0..302120cb8 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextBottom.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilTextBottom.java @@ -67,5 +67,5 @@ public class UtilTextBottom display((prefix == null ? "" : prefix + ChatColor.RESET + " ") + progressBar + (suffix == null ? "" : ChatColor.RESET + " " + suffix), players); } } - } + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java index 635bbeea5..4d1475b02 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/achievement/Achievement.java @@ -519,7 +519,7 @@ public enum Achievement MICRO_BATTLE_ANNIHILATION("Annihilation", 1200, new String[]{"Micro Battle.Annihilation"}, - new String[]{"Kill 12 players in one game"}, + new String[]{"Kill 9 players in one game"}, new int[]{1}, AchievementCategory.MICRO_BATTLE), diff --git a/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java b/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java index 369c7c61c..87e12f7fe 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/explosion/Explosion.java @@ -6,8 +6,10 @@ import java.util.HashMap; import java.util.HashSet; import java.util.Iterator; import java.util.Map.Entry; +import java.util.UUID; import mineplex.core.MiniPlugin; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.core.blockrestore.BlockRestore; @@ -23,12 +25,15 @@ import org.bukkit.block.Block; import org.bukkit.entity.Entity; import org.bukkit.entity.EntityType; import org.bukkit.entity.FallingBlock; +import org.bukkit.entity.Item; +import org.bukkit.entity.Player; import org.bukkit.entity.TNTPrimed; import org.bukkit.event.EventHandler; import org.bukkit.event.EventPriority; import org.bukkit.event.entity.EntityExplodeEvent; import org.bukkit.event.entity.ExplosionPrimeEvent; import org.bukkit.event.entity.ItemSpawnEvent; +import org.bukkit.metadata.FixedMetadataValue; import org.bukkit.plugin.java.JavaPlugin; import org.bukkit.util.Vector; @@ -84,8 +89,19 @@ public class Explosion extends MiniPlugin if (event.blockList().isEmpty()) return; + // This metadata is used to identify the owner of the explosion for use in other plugins + Player owner = null; + Entity entity = event.getEntity(); + if (entity.hasMetadata("owner")) + { + FixedMetadataValue ownerData = (FixedMetadataValue) entity.getMetadata("owner").get(0); + UUID ownerUUID = (UUID) ownerData.value(); + + owner = UtilPlayer.searchExact(ownerUUID); + } + //Event for Block awareness - ExplosionEvent explodeEvent = new ExplosionEvent(event.blockList()); + ExplosionEvent explodeEvent = new ExplosionEvent(event.blockList(), owner); _plugin.getServer().getPluginManager().callEvent(explodeEvent); event.setYield(0f); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/explosion/ExplosionEvent.java b/Plugins/Mineplex.Core/src/mineplex/core/explosion/ExplosionEvent.java index fcab9124f..0ef1fdb01 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/explosion/ExplosionEvent.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/explosion/ExplosionEvent.java @@ -3,6 +3,7 @@ package mineplex.core.explosion; import java.util.Collection; import org.bukkit.block.Block; +import org.bukkit.entity.Player; import org.bukkit.event.Event; import org.bukkit.event.HandlerList; @@ -10,11 +11,18 @@ public class ExplosionEvent extends Event { private static final HandlerList handlers = new HandlerList(); + private Player _owner; private Collection _blocks; public ExplosionEvent(Collection blocks) + { + this(blocks, null); + } + + public ExplosionEvent(Collection blocks, Player owner) { _blocks = blocks; + _owner = owner; } public HandlerList getHandlers() @@ -31,4 +39,14 @@ public class ExplosionEvent extends Event { return _blocks; } + + public Player getOwner() + { + return _owner; + } + + public void setOwner(Player owner) + { + _owner = owner; + } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java index d52f5eb99..83a4b4b28 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/itemstack/ItemStackFactory.java @@ -857,9 +857,12 @@ public class ItemStackFactory extends MiniPlugin stack.setItemMeta(itemMeta); //Unbreakable - ItemMeta meta = stack.getItemMeta(); - meta.spigot().setUnbreakable(true); - stack.setItemMeta(meta); + if (stack.getType().getMaxDurability() > 1) + { + ItemMeta meta = stack.getItemMeta(); + meta.spigot().setUnbreakable(true); + stack.setItemMeta(meta); + } return stack; } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java index a59f02ce2..e530a101b 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Assassin/Illusion.java @@ -7,11 +7,15 @@ import net.minecraft.util.com.mojang.authlib.GameProfile; import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; import org.bukkit.event.block.Action; import org.bukkit.event.entity.EntityDeathEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.ItemSpawnEvent; import org.bukkit.inventory.ItemStack; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; @@ -19,12 +23,14 @@ import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; import mineplex.core.common.util.F; 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.UtilParticle; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.common.util.UtilWorld; import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.minecraft.game.classcombat.Skill.SkillActive; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; @@ -51,14 +57,17 @@ public class Illusion extends SkillActive SetDesc(new String[] { - "Block to go invisible, and create an", + "Hold Block to go invisible and create an", "illusion of yourself that runs towards", "your target location.", "", "Invisibility ends if you release Block", "or your Illusion is killed.", "", - "Lasts up to #2#2 seconds.", + "Illusion lasts up to #2#2 seconds.", + "", + "Gives Slow 2 for up to 4 seconds", + "to nearby players upon ending." }); } @@ -100,7 +109,7 @@ public class Illusion extends SkillActive skel.getEquipment().setLeggings(player.getInventory().getLeggings()); skel.getEquipment().setBoots(player.getInventory().getBoots()); skel.getEquipment().setItemInHand(Math.random() > 0.5 ? player.getItemInHand() : new ItemStack(Material.IRON_AXE)); - + //Disguise DisguisePlayer disguise = new DisguisePlayer(skel, ((CraftPlayer)player).getHandle().getProfile()); Factory.Disguise().disguise(disguise); @@ -115,7 +124,7 @@ public class Illusion extends SkillActive } @EventHandler - public void Energy(UpdateEvent event) + public void update(UpdateEvent event) { if (event.getType() != UpdateType.TICK) return; @@ -150,7 +159,7 @@ public class Illusion extends SkillActive } } - @EventHandler + @EventHandler(priority = EventPriority.HIGHEST) public void illusionDeath(EntityDeathEvent event) { if (_active.containsValue(event.getEntity())) @@ -159,21 +168,36 @@ public class Illusion extends SkillActive event.getEntity().remove(); } } - - private void end(Player cur) + + private void end(Player player) { - Factory.Condition().EndCondition(cur, null, GetName()); + Factory.Condition().EndCondition(player, null, GetName()); - Skeleton skel = _active.remove(cur); + Skeleton skel = _active.remove(player); if (skel == null) return; - - //Ploop + + //Level + int level = getLevel(player); + + //Blind + HashMap targets = UtilEnt.getInRadius(skel.getLocation(), 6d + 0.5 * level); + for (LivingEntity cur : targets.keySet()) + { + if (cur.equals(player)) + continue; + + //Condition + Factory.Condition().Factory().Slow(GetName(), cur, player, 4 * targets.get(cur), 1, false, false, false, false); + } + + //Effect UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, skel.getLocation().add(0, 1, 0), 0.3f, 0.3f, 0.3f, 0.06f, 30); for (int i=0 ; i<2 ; i++) skel.getWorld().playSound(skel.getLocation(), Sound.FIZZ, 2f, 0.4f); + skel.getEquipment().clear(); skel.remove(); } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/CripplingBlow.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/CripplingBlow.java index 71f0fa777..40d570fe3 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/CripplingBlow.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Brute/CripplingBlow.java @@ -53,7 +53,7 @@ public class CripplingBlow extends Skill if (level == 0) return; //Stun - Factory.Condition().Factory().Slow(GetName(), damagee, damager, 0.5 + 0.5 * 1, 1, false, true, false, true); + Factory.Condition().Factory().Slow(GetName(), damagee, damager, 0.5 + 0.5 * 1, 0, false, true, false, true); //Damage event.AddMod(damager.getName(), GetName(), 0, true); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/ISkill.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/ISkill.java index 0a7499f7a..31ca861ab 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/ISkill.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/ISkill.java @@ -37,4 +37,6 @@ public interface ISkill Integer GetSalesPackageId(); int getMaxLevel(); + + boolean isAchievementSkill(); } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/AxeThrow.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/AxeThrow.java new file mode 100644 index 000000000..54263b5a0 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/AxeThrow.java @@ -0,0 +1,203 @@ +package mineplex.minecraft.game.classcombat.Skill.Knight; + +import java.util.HashMap; +import java.util.Iterator; + +import org.bukkit.Effect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.Block; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Item; +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.EntityDamageEvent.DamageCause; +import org.bukkit.event.player.PlayerPickupItemEvent; +import org.bukkit.util.Vector; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.antistack.AntiStack; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +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.projectile.IThrown; +import mineplex.core.projectile.ProjectileUser; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; + +public class AxeThrow extends SkillActive implements IThrown +{ + private HashMap _thrown = new HashMap(); + + public AxeThrow(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Throw your axe with #0.8#0.1 velocity, ", + "dealing #7.5#0.5 damage.", + "", + "You pull your axe back to you when it", + "collides with anything.", + "", + "Your axe is returned to you if you do", + "not pick it up within #20#-2 seconds." + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Inform + UtilPlayer.message(player, F.main("Game", "You used " + F.skill(GetName()) + ".")); + + //Throw + Item item = player.getWorld().dropItem(player.getEyeLocation(), player.getItemInHand()); + UtilAction.velocity(item, player.getLocation().getDirection(), 0.8 + 0.1 * level, false, 0, 0.2, 10, true); + + player.setItemInHand(null); + + //Projectile + Factory.Projectile().AddThrow(item, player, this, -1, true, true, true, false, 2.5d); + + //Store + _thrown.put(item, player); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); + } + + @Override + public void Collide(LivingEntity target, Block block, ProjectileUser data) + { + Rebound(data.GetThrower(), data.GetThrown()); + + if (target == null) + return; + + int level = getLevel(data.GetThrower()); + if (level <= 0) + return; + + double damage = 7.5 + 0.5 * level; + + //Damage Event + Factory.Damage().NewDamageEvent(target, data.GetThrower(), null, + DamageCause.CUSTOM, damage, true, true, false, + UtilEnt.getName(data.GetThrower()), GetName()); + } + + @Override + public void Idle(ProjectileUser data) + { + Rebound(data.GetThrower(), data.GetThrown()); + } + + @Override + public void Expire(ProjectileUser data) + { + Rebound(data.GetThrower(), data.GetThrown()); + } + + public void Rebound(LivingEntity player, Entity ent) + { + ent.getWorld().playSound(ent.getLocation(), Sound.ZOMBIE_WOOD, 0.6f, 0.5f); + + double mult = 0.5 + (0.6 * (UtilMath.offset(player.getLocation(), ent.getLocation())/16d)); + + //Velocity + ent.setVelocity(player.getLocation().toVector().subtract(ent.getLocation().toVector()).normalize().add(new Vector(0, 0.4, 0)).multiply(mult)); + + //Ticks + if (ent instanceof Item) + ((Item)ent).setPickupDelay(5); + } + + @EventHandler + public void pickup(PlayerPickupItemEvent event) + { + if (!_thrown.containsKey(event.getItem())) + return; + + event.setCancelled(true); + + Player player = _thrown.remove(event.getItem()); + + AntiStack.removeUID(event.getItem()); + player.getInventory().addItem(event.getItem().getItemStack()); + + UtilInv.Update(event.getPlayer()); + + event.getItem().remove(); + + player.playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 1f, 1f); + } + + @EventHandler + public void timeout(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + Iterator itemIterator = _thrown.keySet().iterator(); + + while (itemIterator.hasNext()) + { + Item item = itemIterator.next(); + + Player player = _thrown.get(item); + if (!player.isOnline()) + { + item.remove(); + itemIterator.remove(); + continue; + } + + int level = getLevel(player); + + if (item.getTicksLived() > 400 - level * 40) + { + AntiStack.removeUID(item); + _thrown.get(item).getInventory().addItem(item.getItemStack()); + item.remove(); + itemIterator.remove(); + } + } + } + + @Override + public void Reset(Player player) + { + + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Deflection.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Deflection.java index 59338f8f2..75bae265b 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Deflection.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Deflection.java @@ -9,6 +9,8 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.recharge.Recharge; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; @@ -71,13 +73,19 @@ public class Deflection extends Skill if (!Recharge.Instance.use(cur, GetName(), 5000 - (1000 * level), false, false)) continue; + int max = 2 + (1 * level); + int charge = 1; if (_charges.containsKey(cur)) charge += _charges.get(cur); - charge = Math.min(2 + (1 * level), charge); - - _charges.put(cur, charge); + if (charge <= max) + { + _charges.put(cur, charge); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), "Deflection Charges: " + F.elem(charge+""))); + } } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Swordsmanship.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Swordsmanship.java index f803ac8e6..1e29be118 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Swordsmanship.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Knight/Swordsmanship.java @@ -9,7 +9,9 @@ import org.bukkit.event.entity.EntityDamageEvent.DamageCause; import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import mineplex.core.common.util.F; import mineplex.core.common.util.UtilGear; +import mineplex.core.common.util.UtilPlayer; import mineplex.core.recharge.Recharge; import mineplex.core.updater.event.UpdateEvent; import mineplex.core.updater.UpdateType; @@ -76,14 +78,20 @@ public class Swordsmanship extends Skill if (!Recharge.Instance.use(cur, GetName(), 5000 - (1000 * level), false, false)) continue; + + int max = level; int charge = 1; if (_charges.containsKey(cur)) charge += _charges.get(cur); - charge = Math.min(level, charge); - - _charges.put(cur, charge); + if (charge <= max) + { + _charges.put(cur, charge); + + //Inform + UtilPlayer.message(cur, F.main(GetClassType().name(), "Swordsmanship Charges: " + F.elem(charge+""))); + } } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/ArcticArmor.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/ArcticArmor.java index 68e783503..db6b5eda7 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/ArcticArmor.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/ArcticArmor.java @@ -44,7 +44,7 @@ public class ArcticArmor extends Skill "", "Create a freezing area around you", "in a #3#1 Block radius. Allies inside", - "this area receive Protection 1.", + "this area receive Protection 2.", "", "You are permanently immune to the", "Slowing effect of snow." diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java index 2a99c9b68..bfc029e61 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Rupture.java @@ -68,7 +68,7 @@ public class Rupture extends SkillActiveCharge "", "Release Block to release the rupture,", "causing earth and players to fly upward,", - "dealing up to #3#1 inital damage." + "dealing up to #4#1 inital damage." }); } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/StaticLazer.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/StaticLazer.java new file mode 100644 index 000000000..522dd945d --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/StaticLazer.java @@ -0,0 +1,152 @@ +package mineplex.minecraft.game.classcombat.Skill.Mage; + +import java.util.HashMap; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilFirework; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.minecraft.game.classcombat.Skill.SkillChargeSword; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +import org.bukkit.Color; +import org.bukkit.Location; +import org.bukkit.Sound; +import org.bukkit.FireworkEffect.Type; +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.DamageCause; + +public class StaticLazer extends SkillChargeSword +{ + private NautHashMap _chargeStore = new NautHashMap(); + + public StaticLazer(SkillFactory skills, String name, + ClassType classType, SkillType skillType, + int cost, int maxLevel) + { + super(skills, name, classType, skillType, cost, maxLevel, + 0.012f, 0.008f, + 12000, -1000, true, true, + false, true); + + SetDesc(new String[] + { + "Hold Block to charge static electricity.", + "Release Block to fire static lazer.", + "", + GetChargeString(), + "Taking damage cancels charge.", + "", + "Deals up to #7#1 damage and travels", + "up to #20#10 blocks.", + }); + + _fireOnFull = true; + } + + @Override + public String GetRechargeString() + { + return "Recharge: " + "#12#-1 Seconds"; + } + + @Override + public void DoSkillCustom(Player player, float charge) + { + int level = getLevel(player); + if (level <= 0) + return; + + //Action + double curRange = 0; + while (curRange <= 20 + 10 * level) + { + Location newTarget = player.getEyeLocation().add(player.getLocation().getDirection().multiply(curRange)); + + //Hit Player + HashMap hits = UtilEnt.getInRadius(newTarget, 2); + hits.remove(player); + if (!hits.isEmpty()) + break; + + //Hit Block + if (!UtilBlock.airFoliage(newTarget.getBlock())) + break; + + //Progress Forwards + curRange += 0.2; + + //Smoke Trail + UtilParticle.PlayParticle(ParticleType.FIREWORKS_SPARK, newTarget, 0, 0, 0, 0, 1); + } + + //Destination + Location target = player.getLocation().add(player.getLocation().getDirection().multiply(curRange)); + + UtilParticle.PlayParticle(ParticleType.EXPLODE, target, 0, 0, 0, 0, 1); + + //Firework + UtilFirework.playFirework(player.getLocation().add(player.getLocation().getDirection().multiply(Math.max(0, curRange - 0.6))), Type.BURST, Color.WHITE, false, false); + + HashMap hit = UtilEnt.getInRadius(target, 6); + for (LivingEntity other : hit.keySet()) + { + if (other.equals(player)) + continue; + + //Do from center + if (UtilMath.offset(target, other.getLocation().add(0, 1, 0)) < 3) + { + //Damage Event + Factory.Damage().NewDamageEvent(other, player, null, + DamageCause.CUSTOM, 2 + (5 + level) * hit.get(other), true, true, false, + player.getName(), GetName()); + } + } + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(getLevel(player))) + ".")); + + //Effect + player.getWorld().playSound(player.getEyeLocation(), Sound.ZOMBIE_REMEDY, 0.5f + player.getExp(), 1.75f - charge); + + _chargeStore.put(player, charge); + } + + @EventHandler(priority = EventPriority.NORMAL) + public void damageCancelCharge(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + //Damagee + Player damagee = event.GetDamageePlayer(); + if (damagee == null) return; + + if (_charge.remove(damagee) == null) + return; + + //Inform + UtilPlayer.message(damagee, F.main(GetClassType().name(), F.skill(GetName()) + " was interrupted.")); + + //Effect + damagee.getWorld().playSound(damagee.getLocation(), Sound.ZOMBIE_REMEDY, 0.5f, 3f); + + } + + @Override + public void Reset(Player player) + { + _charge.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Void.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Void.java index f30602658..149ae1336 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Void.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Mage/Void.java @@ -33,7 +33,7 @@ public class Void extends Skill "Drop Axe/Sword to Toggle.", "", "While in void form, you receive", - "Slow 3, take no knockback and", + "Slow 2, take no knockback and", "use no energy to swing weapons.", "", "Reduces incoming damage by #1#1 , but", diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/ExplosiveShot.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/ExplosiveShot.java new file mode 100644 index 000000000..a3361a201 --- /dev/null +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/ExplosiveShot.java @@ -0,0 +1,252 @@ +package mineplex.minecraft.game.classcombat.Skill.Ranger; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Iterator; + + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Arrow; +import org.bukkit.entity.Entity; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.block.Action; +import org.bukkit.event.entity.EntityShootBowEvent; +import org.bukkit.event.entity.EntityDamageEvent.DamageCause; +import org.bukkit.event.entity.ProjectileHitEvent; + +import mineplex.minecraft.game.classcombat.Class.IPvpClass.ClassType; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.core.updater.UpdateType; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.minecraft.game.classcombat.Skill.SkillActive; +import mineplex.minecraft.game.classcombat.Skill.SkillFactory; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +public class ExplosiveShot extends SkillActive +{ + private HashSet _arrows = new HashSet(); + private HashSet _active = new HashSet(); + + public ExplosiveShot(SkillFactory skills, String name, ClassType classType, SkillType skillType, + int cost, int levels, + int energy, int energyMod, + long recharge, long rechargeMod, boolean rechargeInform, + Material[] itemArray, + Action[] actionArray) + { + super(skills, name, classType, skillType, + cost, levels, + energy, energyMod, + recharge, rechargeMod, rechargeInform, + itemArray, + actionArray); + + SetDesc(new String[] + { + "Prepare an explosive shot;", + "Your next arrow will explode on", + "impact, dealing up to 12 damage", + "and knockback. ", + " ", + "Explosion radius of #5#1", + }); + } + + @Override + public boolean CustomCheck(Player player, int level) + { + if (player.getLocation().getBlock().getTypeId() == 8 || player.getLocation().getBlock().getTypeId() == 9) + { + UtilPlayer.message(player, F.main("Skill", "You cannot use " + F.skill(GetName()) + " in water.")); + return false; + } + + return true; + } + + @Override + public void Skill(Player player, int level) + { + //Action + _active.add(player); + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You prepared " + F.skill(GetName(level)) + ".")); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.BLAZE_BREATH, 2.5f, 2.0f); + } + + @EventHandler + public void BowShoot(EntityShootBowEvent event) + { + if (!(event.getEntity() instanceof Player)) + return; + + if (!(event.getProjectile() instanceof Arrow)) + return; + + Player player = (Player)event.getEntity(); + + if (!_active.remove(player)) + return; + + //Inform + UtilPlayer.message(player, F.main(GetClassType().name(), "You fired " + F.skill(GetName(getLevel(player))) + ".")); + + _arrows.add((Arrow)event.getProjectile()); + } + + @EventHandler(priority = EventPriority.HIGH) + public void hitEntityTrigger(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetCause() != DamageCause.PROJECTILE) + return; + + Projectile projectile = event.GetProjectile(); + if (projectile == null) + return; + + if (!_arrows.remove(event.GetProjectile())) + return; + + event.SetCancelled(GetName()); + + Location loc = event.GetDamageeEntity().getLocation().subtract(event.GetProjectile().getVelocity().normalize().multiply(0.1)); + + trigger((Arrow)event.GetProjectile(), loc); + } + + @EventHandler + public void hitBlockTrigger(ProjectileHitEvent event) + { + Projectile proj = event.getEntity(); + + if (!_arrows.contains(proj)) + return; + + if (proj.getShooter() == null) + return; + + if (!(proj.getShooter() instanceof Player)) + return; + + Player damager = (Player)proj.getShooter(); + int level = getLevel(damager); + if (level == 0) return; + + final Arrow arrow = (Arrow)proj; + + Factory.GetPlugin().getServer().getScheduler().scheduleSyncDelayedTask(Factory.GetPlugin(), new Runnable() + { + public void run() + { + try + { + //If it hasnt already triggered (via damage) + if (_arrows.remove(arrow)) + trigger(arrow, arrow.getLocation()); + } + catch (Exception e) + { + e.printStackTrace(); + } + } + }, 0); + + //Remove + proj.remove(); + } + + @EventHandler + public void cleanTrigger(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + for (Iterator arrowIterator = _arrows.iterator(); arrowIterator.hasNext();) + { + Arrow arrow = arrowIterator.next(); + + if (arrow.isDead() || !arrow.isValid() || arrow.isOnGround() || arrow.getTicksLived() > 60) + { + arrowIterator.remove(); + trigger(arrow, arrow.getLocation()); + } + } + } + + public void trigger(Arrow arrow, Location loc) + { + if (arrow == null) + return; + + if (arrow.getShooter() == null || !(arrow.getShooter() instanceof Player)) + { + arrow.remove(); + return; + } + + Player player = (Player)arrow.getShooter(); + + //Level + int level = getLevel(player); + if (level == 0) + return; + + //Velocity Players + HashMap hitMap = UtilPlayer.getInRadius(loc, 5 + (level)); + for (Player cur : hitMap.keySet()) + { + double range = hitMap.get(cur); + + //Condition + Factory.Condition().Factory().Falling(GetName(), cur, player, 6, false, true); + + //Damage Event + Factory.Damage().NewDamageEvent(cur, player, null, + DamageCause.CUSTOM, 2 + 10 * range, false, true, false, + player.getName(), GetName()); + + //Velocity + UtilAction.velocity(cur, UtilAlg.getTrajectory2d(loc, cur.getLocation().add(0, 1, 0)), + 0.4 + 1 * range, false, 0, 0.2 + 0.6 * range, 1.2, true); + + //Inform + if (cur instanceof Player) + UtilPlayer.message((Player)cur, F.main(GetClassType().name(), F.name(player.getName()) +" hit you with " + F.skill(GetName(level)) + ".")); + } + + UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, loc, 0, 0, 0, 0, 1); + loc.getWorld().playSound(loc, Sound.EXPLODE, 2f, 0.75f); + } + + @EventHandler + public void particle(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Entity ent : _arrows) + UtilParticle.PlayParticle(ParticleType.LARGE_EXPLODE, ent.getLocation(), 0, 0, 0, 0, 1); + } + + @Override + public void Reset(Player player) + { + _active.remove(player); + } +} diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/NapalmShot.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/NapalmShot.java index 4fcfe8660..368abd7ed 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/NapalmShot.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/NapalmShot.java @@ -48,8 +48,8 @@ public class NapalmShot extends SkillActive SetDesc(new String[] { "Prepare a napalm shot;", - "Your next arrow will explode on", - "impact, releasing #8#8 flames." + "Your next arrow will burst into", + "#8#8 flames on impact." }); } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/PinDown.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/PinDown.java index 34afeb87b..abc8292de 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/PinDown.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/PinDown.java @@ -46,7 +46,7 @@ public class PinDown extends SkillActive SetDesc(new String[] { "Instantly fire an arrow, giving", - "target Slow 3 for #3#1 seconds." + "target Slow 4 for #3#1 seconds." }); } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsFury.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsFury.java index a7122b497..c501014b5 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsFury.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Ranger/WolfsFury.java @@ -78,7 +78,7 @@ public class WolfsFury extends SkillActive _active.put(player, System.currentTimeMillis() + 8000); //Condition - Factory.Condition().Factory().Strength(GetName(), player, player, 2 + 2*level, level-1, false, true, true); + Factory.Condition().Factory().Strength(GetName(), player, player, 2 + 2*level, 2, false, true, true); //Inform UtilPlayer.message(player, F.main(GetClassType().name(), "You used " + F.skill(GetName(level)) + ".")); @@ -133,6 +133,9 @@ public class WolfsFury extends SkillActive int level = getLevel(damager); if (level == 0) return; + + if (!_active.containsKey(damager)) + return; //Remove Swing _swing.remove(damager); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Skill.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Skill.java index cd71c98bf..1f919bf12 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Skill.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/Skill.java @@ -39,6 +39,8 @@ public abstract class Skill implements ISkill, Listener private boolean _free; private NautHashMap _users; + + private boolean _isAchievementSkill = false; public SkillFactory Factory; @@ -327,4 +329,10 @@ public abstract class Skill implements ISkill, Listener { } + + @Override + public boolean isAchievementSkill() + { + return _isAchievementSkill; + } } diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillCharge.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillCharge.java index 1b2313335..2825c5f93 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillCharge.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillCharge.java @@ -13,7 +13,7 @@ public class SkillCharge extends Skill protected float _rateBase; protected float _rateBoost; - + public SkillCharge(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int maxLevel, float base, float boost) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillChargeSword.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillChargeSword.java index 82968c07c..e7857556a 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillChargeSword.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillChargeSword.java @@ -21,6 +21,8 @@ public abstract class SkillChargeSword extends SkillCharge implements Listener protected boolean _rechargeInform = false; protected boolean _rechargeAttach = false; + protected boolean _fireOnFull = false; + public SkillChargeSword(SkillFactory skills, String name, ClassType classType, SkillType skillType, int cost, int maxLevel, float base, float boost, @@ -62,7 +64,18 @@ public abstract class SkillChargeSword extends SkillCharge implements Listener continue; //Charge - Charge(cur); + if (Charge(cur) && _fireOnFull) + { + //Action + float charge = _charge.remove(cur); + + //Set Recharge + Recharge.Instance.recharge(cur, GetName()); + Recharge.Instance.use(cur, GetName(), _recharge + (getLevel(cur) * _rechargePerLevel), true, true); + + DoSkill(cur, charge); + } + } //Release Charge else if (_charge.containsKey(cur)) diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java index bff765694..69f553c13 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/Skill/SkillFactory.java @@ -167,13 +167,13 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory 0, 0, true, new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); -// -// AddSkill(new Illusion(this, "Illusion", ClassType.Assassin, SkillType.Sword, -// 1, 4, -// 30, -5, -// 0, 0, true, -// new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, -// new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new Illusion(this, "Illusion", ClassType.Assassin, SkillType.Sword, + 1, 4, + 30, -5, + 12000, -1000, true, + new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); //Axe AddSkill(new Blink(this, "Blink", ClassType.Assassin, SkillType.Axe, @@ -327,6 +327,13 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory 8000, -1000, true, new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + + AddSkill(new AxeThrow(this, "Roped Axe Throw", ClassType.Knight, SkillType.Axe, + 1, 5, + 0, 0, + 3000, -450, true, + new Material[] {Material.IRON_AXE, Material.GOLD_AXE, Material.DIAMOND_AXE}, + new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); //Passive A @@ -366,6 +373,8 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory new Material[] {Material.IRON_SWORD, Material.GOLD_SWORD, Material.DIAMOND_SWORD}, new Action[] {Action.RIGHT_CLICK_AIR, Action.RIGHT_CLICK_BLOCK})); + AddSkill(new StaticLazer(this, "Static Lazer", ClassType.Mage, SkillType.Sword, 1, 5)); + //Axe AddSkill(new FireBlast(this, "Fire Blast", ClassType.Mage, SkillType.Axe, 1, 5, @@ -491,6 +500,13 @@ public class SkillFactory extends MiniPlugin implements ISkillFactory 10000, -1500, false, new Material[] {Material.BOW}, new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); + + AddSkill(new ExplosiveShot(this, "Explosive Arrow", ClassType.Ranger, SkillType.Bow, + 1, 4, + 0, 0, + 20000, -2000, false, + new Material[] {Material.BOW}, + new Action[] {Action.LEFT_CLICK_AIR, Action.LEFT_CLICK_BLOCK})); //Passive A AddSkill(new Barrage(this, "Barrage", ClassType.Ranger, SkillType.PassiveA, 1, 3)); diff --git a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java index 4842ce011..05b905b05 100644 --- a/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java +++ b/Plugins/Mineplex.Minecraft.Game.ClassCombat/src/mineplex/minecraft/game/classcombat/shop/ClassShopManager.java @@ -1,8 +1,11 @@ package mineplex.minecraft.game.classcombat.shop; +import org.bukkit.entity.Player; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; +import mineplex.core.achievement.Achievement; +import mineplex.core.achievement.AchievementManager; import mineplex.minecraft.game.classcombat.Class.ClassManager; import mineplex.minecraft.game.classcombat.Skill.SkillFactory; import mineplex.minecraft.game.classcombat.item.ItemFactory; @@ -12,6 +15,7 @@ public class ClassShopManager extends MiniPlugin private ClassManager _classManager; private SkillFactory _skillFactory; private ItemFactory _itemFactory; + private AchievementManager _achievementManager; public ClassShopManager(JavaPlugin plugin, ClassManager classManager, SkillFactory skillFactory, ItemFactory itemFactory) { @@ -20,6 +24,7 @@ public class ClassShopManager extends MiniPlugin _classManager = classManager; _skillFactory = skillFactory; _itemFactory = itemFactory; + //_achievementManager = achievementManager; } public ClassManager GetClassManager() @@ -36,4 +41,18 @@ public class ClassShopManager extends MiniPlugin { return _itemFactory; } + + public boolean hasAchievements(Player player) + { + return _achievementManager.hasCategory(player, new Achievement[] + { + Achievement.CHAMPIONS_ACE, + Achievement.CHAMPIONS_ASSASSINATION, + Achievement.CHAMPIONS_EARTHQUAKE, + Achievement.CHAMPIONS_FLAWLESS_VICTORY, + Achievement.CHAMPIONS_MASS_ELECTROCUTION, + Achievement.CHAMPIONS_THE_LONGEST_SHOT, + Achievement.CHAMPIONS_WINS, + }); + } } 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 23404cac7..4747ac36e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/ArcadeManager.java @@ -104,6 +104,7 @@ import nautilus.game.arcade.managers.GameLobbyManager; import nautilus.game.arcade.managers.GameLootManager; import nautilus.game.arcade.managers.GameManager; import nautilus.game.arcade.managers.GamePlayerManager; +import nautilus.game.arcade.managers.GameSpectatorManager; import nautilus.game.arcade.managers.GameStatManager; import nautilus.game.arcade.managers.GameTournamentManager; import nautilus.game.arcade.managers.GameWorldManager; @@ -263,6 +264,7 @@ public class ArcadeManager extends MiniPlugin implements IRelation _gameTournamentManager = new GameTournamentManager(this); new GameStatManager(this); new GameLootManager(this, petManager); + new GameSpectatorManager(this); _gameWorldManager = new GameWorldManager(this); new MiscManager(this); _idleManager = new IdleManager(this); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java index 6a6496739..c3832eae2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/Game.java @@ -11,18 +11,27 @@ import org.bukkit.Bukkit; import org.bukkit.ChatColor; import org.bukkit.GameMode; import org.bukkit.Location; +import org.bukkit.Material; import org.bukkit.Sound; import org.bukkit.block.BlockFace; import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.Entity; import org.bukkit.entity.Hanging; +import org.bukkit.entity.Minecart; import org.bukkit.entity.Player; +import org.bukkit.entity.minecart.CommandMinecart; +import org.bukkit.entity.minecart.ExplosiveMinecart; +import org.bukkit.entity.minecart.HopperMinecart; +import org.bukkit.entity.minecart.PoweredMinecart; +import org.bukkit.entity.minecart.StorageMinecart; import org.bukkit.event.EventHandler; import org.bukkit.event.HandlerList; import org.bukkit.event.Listener; import org.bukkit.event.entity.EntityDamageEvent; import org.bukkit.event.hanging.HangingBreakEvent; import org.bukkit.event.hanging.HangingPlaceEvent; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; import org.bukkit.event.player.PlayerLoginEvent; import org.bukkit.scoreboard.Objective; import org.bukkit.util.Vector; @@ -31,11 +40,14 @@ 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.UtilEvent; +import mineplex.core.common.util.UtilGear; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTabTitle; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilTextMiddle; +import mineplex.core.common.util.UtilEvent.ActionType; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.minecraft.game.classcombat.event.ClassCombatCreatureAllowSpawnEvent; @@ -1274,4 +1286,8 @@ public abstract class Game implements Listener loc.getY() >= WorldData.MaxY || loc.getY() <= WorldData.MinY); } + + + + } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java index bba5f08b7..38b385611 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/Bridge.java @@ -962,9 +962,27 @@ public class Bridge extends TeamGame implements OreObsfucation } @EventHandler - public void OreReveal(ExplosionEvent event) + public void handleExplosion(ExplosionEvent event) { + // Reveal ore that are inside the explosion _ore.Explosion(event); + + // Handle block ownership for explosion + if (event.getOwner() != null) + { + for (Block cur : event.GetBlocks()) + { + // These are the only blocks that will drop from the explosion so they are the only ones + // we need to worry about for keeping owner data of + if (cur.getType() == Material.IRON_ORE || + cur.getType() == Material.COAL_ORE || + cur.getType() == Material.GOLD_ORE || + cur.getType() == Material.DIAMOND_ORE) + { + _blockToUUIDMap.put(cur, event.getOwner().getUniqueId()); + } + } + } } @EventHandler(priority = EventPriority.MONITOR) @@ -992,22 +1010,14 @@ public class Bridge extends TeamGame implements OreObsfucation "Cannot place blocks this high up.")); event.setCancelled(true); return; - } - - //Under Water - if (event.getBlock().getRelative(BlockFace.UP).isLiquid()) - { - UtilPlayer.message(event.getPlayer(), F.main("Game", - "Cannot place blocks under liquids.")); - event.setCancelled(true); - return; - } + } if (_bridgesDown) return; - + //In Liquid - if (event.getBlockReplacedState().getTypeId() == 8 || + if (event.getBlock().getRelative(BlockFace.UP).isLiquid() || + event.getBlockReplacedState().getTypeId() == 8 || event.getBlockReplacedState().getTypeId() == 9 || event.getBlockReplacedState().getTypeId() == 10 || event.getBlockReplacedState().getTypeId() == 11) @@ -1597,7 +1607,7 @@ public class Bridge extends TeamGame implements OreObsfucation // } @EventHandler - public void boatDeny(PlayerInteractEvent event) + public void vehicleDeny(PlayerInteractEvent event) { if (!UtilEvent.isAction(event, ActionType.R)) return; 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 41d486acc..0f94bac6e 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 @@ -562,7 +562,7 @@ public class DragonEscape extends SoloGame if (!UtilTime.elapsed(GetStateTime(), 10000)) { - UtilPlayer.message(player, F.main("Game", "You cannot dig for " + F.elem(UtilTime.MakeStr(6000 - (System.currentTimeMillis() - GetStateTime())) + "."))); + UtilPlayer.message(player, F.main("Game", "You cannot dig for " + F.elem(UtilTime.MakeStr(10000 - (System.currentTimeMillis() - GetStateTime())) + "."))); return; } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java index af94a2e98..7fdfa95d9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java @@ -60,7 +60,7 @@ public class Micro extends TeamGame this.BlockBreak = true; this.BlockPlace = true; - registerStatTrackers(new KillsWithinGameStatTracker(this, 12, "Annihilation")); + registerStatTrackers(new KillsWithinGameStatTracker(this, 9, "Annihilation")); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java index 29356c629..ced769682 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/Paintball.java @@ -99,7 +99,6 @@ public class Paintball extends TeamGame } private HashMap _doubles = new HashMap(); - private HashSet _water = new HashSet(); public Paintball(ArcadeManager manager) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java index 213e30650..cd3b822ca 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/PlayerCopy.java @@ -3,21 +3,23 @@ package nautilus.game.arcade.game.games.paintball; import mineplex.core.common.util.C; import mineplex.core.common.util.UtilEnt; import mineplex.core.disguise.disguises.DisguisePlayer; +import nautilus.game.arcade.game.Game; import org.bukkit.ChatColor; import org.bukkit.EntityEffect; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.entity.Skeleton; public class PlayerCopy { - private Paintball Host; + private Game Host; private Skeleton _ent; private Player _owner; - public PlayerCopy(Paintball host, Player owner) + public PlayerCopy(Game host, Player owner) { Host = host; @@ -34,12 +36,12 @@ public class PlayerCopy //Armor _ent.getEquipment().setArmorContents(owner.getInventory().getArmorContents()); - _ent.setCustomName(C.cWhite + C.Bold + C.Scramble + "XX" + ChatColor.RESET + " " + host.GetTeam(owner).GetColor() + owner.getName() + " " + C.cWhite + C.Bold + C.Scramble + "XX"); + _ent.setCustomName(C.cWhite + C.Bold + C.Scramble + "XX" + ChatColor.RESET + " " + C.cYellow + owner.getName() + " " + C.cWhite + C.Bold + C.Scramble + "XX"); _ent.setCustomNameVisible(true); //Disguise - ////DisguisePlayer disguise = new DisguisePlayer(_ent, owner.getName()); - //Host.Manager.GetDisguise().disguise(disguise); +// DisguisePlayer disguise = new DisguisePlayer(_ent, ((CraftPlayer)owner).getProfile()); +// Host.Manager.GetDisguise().disguise(disguise); } public LivingEntity GetEntity() diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java index dea7b7783..468926a9b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/WitherGame.java @@ -6,13 +6,23 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Set; +import org.bukkit.Bukkit; import org.bukkit.ChatColor; +import org.bukkit.EntityEffect; +import org.bukkit.GameMode; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.block.Block; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; +import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.entity.ThrownPotion; import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.entity.EntityCombustEvent; +import org.bukkit.event.entity.ProjectileHitEvent; import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.potion.PotionEffectType; import org.bukkit.util.Vector; import mineplex.core.common.util.C; @@ -22,12 +32,15 @@ import mineplex.core.common.util.UtilAlg; import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilTextMiddle; import mineplex.core.common.util.UtilTime; import mineplex.core.data.BlockData; 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 mineplex.minecraft.game.core.damage.CustomDamageEvent; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; @@ -35,6 +48,9 @@ import nautilus.game.arcade.events.PlayerDeathOutEvent; import nautilus.game.arcade.events.PlayerKitGiveEvent; import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.TeamGame; +import nautilus.game.arcade.game.GameTeam.PlayerState; +import nautilus.game.arcade.game.games.paintball.PlayerCopy; +import nautilus.game.arcade.game.games.paintball.Paintball.ReviveEvent; import nautilus.game.arcade.game.games.wither.kit.*; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.NullKit; @@ -44,15 +60,17 @@ public class WitherGame extends TeamGame implements IBlockRestorer { private GameTeam _runners; private GameTeam _withers; - + private double _witherFactor = 2.5; private int _yLimit = 0; private long _gameTime = 300000; - private int _livesPerPlayer = 3; - private HashMap _lives = new HashMap(); + private HashMap _doubles = new HashMap(); + +// private int _livesPerPlayer = 3; +// private HashMap _lives = new HashMap(); private HashSet _blocks = new HashSet(); @@ -62,10 +80,9 @@ public class WitherGame extends TeamGame implements IBlockRestorer new Kit[] { - //new KitHumanRunner(manager), new KitHumanArcher(manager), new KitHumanBuilder(manager), - new NullKit(manager), + new KitHumanRunner(manager), new NullKit(manager), new KitWitherMinion(manager), //new KitWitherWeb(manager), @@ -75,8 +92,8 @@ public class WitherGame extends TeamGame implements IBlockRestorer new String[] { - C.cGreen + "Humans" + C.cWhite + " Find Armor Upgrades to help surive!", - C.cGreen + "Humans" + C.cWhite + " 5 Lives per Player", + C.cGreen + "Humans" + C.cWhite + " Run and hide from the Withers", + C.cGreen + "Humans" + C.cWhite + " Revive your dead allies!", C.cGreen + "Humans" + C.cWhite + " Win by surviving for 5 minutes", " ", C.cRed + "Withers" + C.cWhite + " Moves very slowly when near ground", @@ -95,6 +112,9 @@ public class WitherGame extends TeamGame implements IBlockRestorer this.KitRegisterState = GameState.Prepare; + this.TeamArmor = true; + this.TeamArmorHotbar = false; + _help = new String[] { C.cRed + C.Bold + "This game is in early stages of development!", @@ -164,15 +184,17 @@ public class WitherGame extends TeamGame implements IBlockRestorer public void setWither(Player player, boolean forced) { - _lives.remove(player); +// _lives.remove(player); SetPlayerTeam(player, _withers, true); - + //Kit Kit newKit = GetKits()[4]; SetKit(player, newKit, false); newKit.ApplyKit(player); + + player.teleport(_withers.GetSpawn()); if (forced) { @@ -185,25 +207,25 @@ public class WitherGame extends TeamGame implements IBlockRestorer } } - @EventHandler - public void playerDead(final PlayerDeathOutEvent event) - { - Player player = event.GetPlayer(); - - if (_lives.containsKey(player)) - { - int lives = _lives.get(player); - - if (lives <= 1) - return; - - _lives.put(player, lives - 1); - - UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen + C.Bold + lives + " Lives Remaining") + ".")); - - event.setCancelled(true); - } - } +// @EventHandler +// public void playerLoseLife(final PlayerDeathOutEvent event) +// { +// Player player = event.GetPlayer(); +// +// if (_lives.containsKey(player)) +// { +// int lives = _lives.get(player); +// +// if (lives <= 1) +// return; +// +// _lives.put(player, lives - 1); +// +// UtilPlayer.message(player, F.main("Game", "You have " + F.elem(C.cGreen + C.Bold + lives + " Lives Remaining") + ".")); +// +// event.setCancelled(true); +// } +// } @EventHandler public void gameStart(GameStateChangeEvent event) @@ -211,31 +233,31 @@ public class WitherGame extends TeamGame implements IBlockRestorer if (event.GetState() != GameState.Live) return; - UtilTextMiddle.display(C.cGreen + "Humans Hiding", "12 Seconds until Assault", 10, 80, 10); + UtilTextMiddle.display(C.cGreen + "Humans Hiding", "15 Seconds until Assault", 10, 80, 10); for (Player player : _withers.GetPlayers(true)) { - Manager.GetCondition().Factory().Blind("Game Start", player, null, 12, 0, false, false, false); + Manager.GetCondition().Factory().Blind("Game Start", player, null, 15, 0, false, false, false); } } - @EventHandler - public void playerLivesDisplay(PlayerKitGiveEvent event) - { - if (!_runners.HasPlayer(event.GetPlayer())) - return; - - //Player Lives - if (!_lives.containsKey(event.GetPlayer())) - _lives.put(event.GetPlayer(), _livesPerPlayer); - - int lives = _lives.get(event.GetPlayer()); - - if (lives <= 0) - return; - - event.GetPlayer().getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, lives, C.cGreen + C.Bold + lives + " Lives Remaining")); - } +// @EventHandler +// public void playerLivesDisplay(PlayerKitGiveEvent event) +// { +// if (!_runners.HasPlayer(event.GetPlayer())) +// return; +// +// //Player Lives +// if (!_lives.containsKey(event.GetPlayer())) +// _lives.put(event.GetPlayer(), _livesPerPlayer); +// +// int lives = _lives.get(event.GetPlayer()); +// +// if (lives <= 0) +// return; +// +// event.GetPlayer().getInventory().setItem(8, ItemStackFactory.Instance.CreateStack(Material.BONE, (byte)0, lives, C.cGreen + C.Bold + lives + " Lives Remaining")); +// } @Override public void EndCheck() @@ -292,9 +314,9 @@ public class WitherGame extends TeamGame implements IBlockRestorer if (event.getType() != UpdateType.FAST) return; - int lives = 0; - for (int i : _lives.values()) - lives += i; +// int lives = 0; +// for (int i : _lives.values()) +// lives += i; //Wipe Last Scoreboard.Reset(); @@ -307,9 +329,9 @@ public class WitherGame extends TeamGame implements IBlockRestorer Scoreboard.Write(_withers.GetColor() + C.Bold + _withers.GetName()); Scoreboard.Write(_withers.GetColor() + "" + _withers.GetPlayers(true).size() + " Players"); - Scoreboard.WriteBlank(); - Scoreboard.Write(C.cYellow + C.Bold + "Human Lives"); - Scoreboard.Write(lives + " / " + (_lives.size() * _livesPerPlayer)); +// Scoreboard.WriteBlank(); +// Scoreboard.Write(C.cYellow + C.Bold + "Humans Alive"); +// Scoreboard.Write(lives + " / " + (_lives.size() * _livesPerPlayer)); Scoreboard.WriteBlank(); Scoreboard.Write(C.cYellow + C.Bold + "Time Left"); @@ -357,7 +379,7 @@ public class WitherGame extends TeamGame implements IBlockRestorer ArrayList collisions = new ArrayList(); //Fly Speed - double speed = 0.06 - (_yLimit - player.getLocation().getY()) * 0.075; + double speed = 0.06 - (_yLimit - player.getLocation().getY()) * 0.0075; if (speed > 0.16) speed = 0.16; @@ -431,29 +453,214 @@ public class WitherGame extends TeamGame implements IBlockRestorer } } +// @EventHandler +// public void cleanLives(PlayerQuitEvent event) +// { +// _lives.remove(event.getPlayer()); +// } + +// @EventHandler +// public void livesUpdate(UpdateEvent event) +// { +// if (!IsLive()) +// return; +// +// if (event.getType() != UpdateType.FASTER) +// return; +// +// Iterator playerIter = _lives.keySet().iterator(); +// +// while (playerIter.hasNext()) +// { +// Player player = playerIter.next(); +// +// if (!player.isOnline() || !_runners.HasPlayer(player)) +// playerIter.remove(); +// } +// } + @EventHandler - public void playerQuit(PlayerQuitEvent event) + public void arrowDamage(CustomDamageEvent event) { - _lives.remove(event.getPlayer()); + if (event.GetProjectile() == null) + return; + + event.AddMult(GetName(), "Arrow Mod", 0.75, false); + } + + @EventHandler(priority = EventPriority.HIGHEST) + public void damageOut(CustomDamageEvent event) + { + if (event.IsCancelled()) + return; + + if (event.GetDamageePlayer() == null) + return; + + if (event.GetDamage() < event.GetDamageePlayer().getHealth()) + return; + + event.SetCancelled("Fake Death"); + + event.GetDamageePlayer().playEffect(EntityEffect.HURT); + + playerOut(event.GetDamageePlayer()); + } + + public void playerOut(Player player) + { + //State + SetPlayerState(player, PlayerState.OUT); + player.setHealth(20); + + //Conditions + Manager.GetCondition().Factory().Blind("Hit", player, player, 1.5, 0, false, false, false); + Manager.GetCondition().Factory().Cloak("Hit", player, player, 9999, false, false); + + //Settings + player.setGameMode(GameMode.CREATIVE); + player.setFlying(true); + ((CraftPlayer)player).getHandle().spectating = true; + ((CraftPlayer)player).getHandle().k = false; + + player.setVelocity(new Vector(0,1.2,0)); + + _doubles.put(player, new PlayerCopy(this, player)); + } + + public void playerIn(final Player player, final LivingEntity copy) + { + //State + SetPlayerState(player, PlayerState.IN); + player.setHealth(20); + + //Teleport + if (copy != null) + { + Location loc = player.getLocation(); + loc.setX(copy.getLocation().getX()); + loc.setY(copy.getLocation().getY()); + loc.setZ(copy.getLocation().getZ()); + player.teleport(loc); + } + + //Settings + player.setGameMode(GameMode.SURVIVAL); + player.setFlying(false); + ((CraftPlayer)player).getHandle().spectating = false; + ((CraftPlayer)player).getHandle().k = true; + + //Items + player.getInventory().remove(Material.WATCH); + player.getInventory().remove(Material.COMPASS); + + //Inform + UtilPlayer.message(player, F.main("Game", "You have been revived!")); + + //Delayed Visibility + if (copy != null) + { + UtilServer.getServer().getScheduler().scheduleSyncDelayedTask(Manager.GetPlugin(), new Runnable() + { + public void run() + { + //Remove Invis + if (IsAlive(player)) + Manager.GetCondition().EndCondition(player, ConditionType.CLOAK, null); + + //Remove Copy + copy.remove(); + } + }, 4); + } } @EventHandler - public void livesUpdate(UpdateEvent event) + public void revive(ProjectileHitEvent event) { if (!IsLive()) return; - if (event.getType() != UpdateType.FASTER) + if (!(event.getEntity() instanceof ThrownPotion)) + return; + + if (event.getEntity().getShooter() == null) + return; + + if (!(event.getEntity().getShooter() instanceof Player)) + return; + + Player thrower = (Player)event.getEntity().getShooter(); + + GameTeam throwerTeam = GetTeam(thrower); + if (throwerTeam == null) return; + + //Revive + Iterator copyIterator = _doubles.values().iterator(); + while (copyIterator.hasNext()) + { + PlayerCopy copy = copyIterator.next(); + + GameTeam otherTeam = GetTeam(copy.GetPlayer()); + if (otherTeam == null || !otherTeam.equals(throwerTeam)) + continue; + + if (UtilMath.offset(copy.GetEntity().getLocation().add(0,1,0), event.getEntity().getLocation()) > 3) + continue; + + playerIn(copy.GetPlayer(), copy.GetEntity()); + copyIterator.remove(); + + AddGems(thrower, 3, "Revived Ally", true); + } + + //Revive + for (Player player : GetPlayers(true)) + { + GameTeam otherTeam = GetTeam(player); + if (otherTeam == null || !otherTeam.equals(throwerTeam)) + continue; + + if (UtilMath.offset(player.getLocation().add(0,1,0), event.getEntity().getLocation()) > 3) + continue; + + playerIn(player, null); + } + } + + @EventHandler + public void removePotionEffect(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) return; - Iterator playerIter = _lives.keySet().iterator(); - - while (playerIter.hasNext()) + for (Player player : GetPlayers(true)) + player.removePotionEffect(PotionEffectType.WATER_BREATHING); + } + + @EventHandler + public void skeletonDamage(CustomDamageEvent event) + { + for (PlayerCopy copy : _doubles.values()) { - Player player = playerIter.next(); - - if (!player.isOnline() || !_runners.HasPlayer(player)) - playerIter.remove(); + if (copy.GetEntity().equals(event.GetDamageeEntity())) + { + event.SetCancelled("Runner Copy Cancel"); + break; + } + } + } + + @EventHandler + public void skeletonCombust(EntityCombustEvent event) + { + for (PlayerCopy copy : _doubles.values()) + { + if (copy.GetEntity().equals(event.getEntity())) + { + event.setCancelled(true); + break; + } } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java index 73ef95176..64e3ce79e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanArcher.java @@ -1,10 +1,15 @@ package nautilus.game.arcade.game.games.wither.kit; +import org.bukkit.ChatColor; import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.PotionMeta; +import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; @@ -28,7 +33,7 @@ public class KitHumanArcher extends Kit new Perk[] { new PerkRopedArrow("Roped Arrow", 1, 4000), - new PerkWitherArrowBlind(3), + new PerkWitherArrowBlind(6), new PerkFletcher(4, 4, true), }, @@ -42,10 +47,15 @@ public class KitHumanArcher extends Kit { player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SWORD)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + + ItemStack potion = new ItemStack(Material.POTION, 3, (short)16429); // 16422 + PotionMeta potionMeta = (PotionMeta)potion.getItemMeta(); + potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion"); + potion.setItemMeta(potionMeta); + player.getInventory().addItem(potion); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - - Manager.GetCondition().Factory().Invulnerable("Spawn Invul", player, player, 6, false, false); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanBuilder.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanBuilder.java index b4920e54f..531296842 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanBuilder.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanBuilder.java @@ -1,10 +1,15 @@ package nautilus.game.arcade.game.games.wither.kit; +import org.bukkit.ChatColor; import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.PotionMeta; +import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; @@ -39,10 +44,15 @@ public class KitHumanBuilder extends Kit { player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_SPADE)); + + ItemStack potion = new ItemStack(Material.POTION, 3, (short)16429); // 16422 + PotionMeta potionMeta = (PotionMeta)potion.getItemMeta(); + potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion"); + potion.setItemMeta(potionMeta); + player.getInventory().addItem(potion); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - - Manager.GetCondition().Factory().Invulnerable("Spawn Invul", player, player, 6, false, false); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanRunner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanRunner.java index 485cbac84..5f2b94c9a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanRunner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitHumanRunner.java @@ -1,24 +1,29 @@ package nautilus.game.arcade.game.games.wither.kit; +import org.bukkit.ChatColor; import org.bukkit.Material; +import org.bukkit.craftbukkit.v1_7_R4.entity.CraftPlayer; import org.bukkit.entity.EntityType; import org.bukkit.entity.LivingEntity; import org.bukkit.entity.Player; import org.bukkit.inventory.ItemStack; +import org.bukkit.inventory.meta.PotionMeta; import mineplex.core.common.util.C; +import mineplex.core.disguise.disguises.DisguisePlayer; import mineplex.core.itemstack.ItemStackFactory; import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; import nautilus.game.arcade.kit.Perk; +import nautilus.game.arcade.kit.perks.PerkDoubleJump; import nautilus.game.arcade.kit.perks.PerkLeap; public class KitHumanRunner extends Kit { public KitHumanRunner(ArcadeManager manager) { - super(manager, "Human Leaper", KitAvailability.Free, + super(manager, "Human Jumper", KitAvailability.Free, new String[] { @@ -27,7 +32,7 @@ public class KitHumanRunner extends Kit new Perk[] { - new PerkLeap("Leap", 1, 1, 4000) + new PerkDoubleJump("Double Jump", 1, 0.8, true, 6000, true), }, EntityType.ZOMBIE, null); @@ -38,10 +43,15 @@ public class KitHumanRunner extends Kit public void GiveItems(Player player) { player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.IRON_AXE)); + + ItemStack potion = new ItemStack(Material.POTION, 3, (short)16429); // 16422 + PotionMeta potionMeta = (PotionMeta)potion.getItemMeta(); + potionMeta.setDisplayName(ChatColor.RESET + "Revival Potion"); + potion.setItemMeta(potionMeta); + player.getInventory().addItem(potion); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.MUSHROOM_SOUP)); - - Manager.GetCondition().Factory().Invulnerable("Spawn Invul", player, player, 6, false, false); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitWitherMinion.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitWitherMinion.java index fe3df5c2c..15b19a46b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitWitherMinion.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/wither/kit/KitWitherMinion.java @@ -38,22 +38,22 @@ public class KitWitherMinion extends Kit new PerkWitherAttack(), new PerkWitherMinion() }, - EntityType.SKELETON, + EntityType.WITHER, null); } - @Override - public void SpawnCustom(LivingEntity ent) - { - ent.setMaxHealth(300); - ent.setHealth(300); - - DisguiseWither disguise = new DisguiseWither(ent); - disguise.SetName(C.cYellow + "Wither"); - disguise.SetCustomNameVisible(true); - Manager.GetDisguise().disguise(disguise); - } +// @Override +// public void SpawnCustom(LivingEntity ent) +// { +// ent.setMaxHealth(300); +// ent.setHealth(300); +// +// DisguiseWither disguise = new DisguiseWither(ent); +// disguise.SetName(C.cYellow + "Wither"); +// disguise.SetCustomNameVisible(true); +// Manager.GetDisguise().disguise(disguise); +// } @Override public void GiveItems(Player player) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBomber.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBomber.java index 5f5cd35e2..2c47bfd0c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBomber.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkBomber.java @@ -14,6 +14,7 @@ import org.bukkit.event.block.*; import org.bukkit.event.entity.*; import org.bukkit.event.inventory.*; import org.bukkit.event.player.*; +import org.bukkit.metadata.FixedMetadataValue; import java.util.*; @@ -169,6 +170,8 @@ public class PerkBomber extends Perk UtilAction.velocity(tnt, player.getLocation().getDirection(), 0.5, false, 0, 0.1, 10, false); + tnt.setMetadata("owner", new FixedMetadataValue(Manager.GetPlugin(), player.getUniqueId())); + _tntMap.put(tnt, player); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherArrowBlind.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherArrowBlind.java index 6073b0d51..50f378e1d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherArrowBlind.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherArrowBlind.java @@ -96,7 +96,7 @@ public class PerkWitherArrowBlind extends Perk boolean hit = false; for (Player player : getWitherTeam().GetPlayers(true)) { - if (UtilMath.offset(player.getLocation().add(0, 1, 0), arrow.getLocation()) < _proximityHit) + if (UtilMath.offset(player.getLocation().add(0, 3, 0), arrow.getLocation()) < _proximityHit) { Manager.GetCondition().Factory().Blind(GetName(), player, null, 4, 0, false, false, false); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherArrows.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherArrows.java index ed4732d48..3af7e1077 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherArrows.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkWitherArrows.java @@ -41,11 +41,11 @@ public class PerkWitherArrows extends Perk if (!player.isBlocking()) { - player.setExp((float) Math.min(0.999, player.getExp()+(1f/30f))); + player.setExp((float) Math.min(0.999, player.getExp()+(1f/20f))); } else if (player.getExp() > 0) { - player.setExp((float) Math.max(0, player.getExp()-(1f/30f))); + player.setExp((float) Math.max(0, player.getExp()-(1f/20f))); for (int i=0 ; i<1 ; i++) { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java index 3dc93b055..5b104aa5f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameLootManager.java @@ -58,9 +58,9 @@ public class GameLootManager implements Listener false); //Chest - _rewardManager.addReward(new InventoryReward(_rewardManager, Manager.getInventoryManager(), "Treasure Chest", "Treasure Chest", 1, 1, + _rewardManager.addReward(new InventoryReward(_rewardManager, Manager.getInventoryManager(), "Treasure Chest", "Treasure Chest", 1, 2, new ItemStack(Material.CHEST), RewardRarity.COMMON, 4)); - + //Key _rewardManager.addReward(new InventoryReward(_rewardManager, Manager.getInventoryManager(), "Treasure Key", "Treasure Key", 1, 1, new ItemStack(Material.DIAMOND), RewardRarity.UNCOMMON, 1000)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java new file mode 100644 index 000000000..28fb3fe5f --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/GameSpectatorManager.java @@ -0,0 +1,72 @@ +package nautilus.game.arcade.managers; + +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.game.Game.GameState; + +import org.bukkit.Material; +import org.bukkit.entity.Minecart; +import org.bukkit.entity.Player; +import org.bukkit.entity.minecart.CommandMinecart; +import org.bukkit.entity.minecart.ExplosiveMinecart; +import org.bukkit.entity.minecart.HopperMinecart; +import org.bukkit.entity.minecart.PoweredMinecart; +import org.bukkit.entity.minecart.StorageMinecart; +import org.bukkit.event.EventHandler; +import org.bukkit.event.EventPriority; +import org.bukkit.event.Listener; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEntityEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.vehicle.VehicleDamageEvent; + +public class GameSpectatorManager implements Listener +{ + ArcadeManager Manager; + + public GameSpectatorManager(ArcadeManager manager) + { + Manager = manager; + + Manager.GetPluginManager().registerEvents(this, Manager.GetPlugin()); + } + + @EventHandler(priority = EventPriority.LOW) + public void interactCancel(PlayerInteractEvent event) + { + if (Manager.GetGame() == null) + return; + + Player player = event.getPlayer(); + + if (!Manager.GetGame().IsAlive(player)) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOW) + public void interactEntityCancel(PlayerInteractEntityEvent event) + { + if (Manager.GetGame() == null) + return; + + Player player = event.getPlayer(); + + if (!Manager.GetGame().IsAlive(player)) + event.setCancelled(true); + } + + @EventHandler(priority = EventPriority.LOW) + public void vehicleDamage(VehicleDamageEvent event) + { + if (Manager.GetGame() == null) + return; + + if (!(event.getAttacker() instanceof Player)) + return; + + Player player = (Player)event.getAttacker(); + + if (!Manager.GetGame().IsAlive(player)) + event.setCancelled(true); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java index ca4065813..dceef7794 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/managers/MiscManager.java @@ -52,12 +52,8 @@ public class MiscManager implements Listener Player player = event.getPlayer(); - if (!Manager.GetGame().IsAlive(player)) - { - event.setCancelled(true); - } //BoneMeal - else if (event.getPlayer().getItemInHand().getType() == Material.INK_SACK && event.getPlayer().getItemInHand().getData().getData() == (byte)15) + if (event.getPlayer().getItemInHand().getType() == Material.INK_SACK && event.getPlayer().getItemInHand().getData().getData() == (byte)15) { if (event.getAction() == Action.RIGHT_CLICK_BLOCK && Manager.GetGame().GetType() != GameType.UHC) event.setCancelled(true);