diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java index b6fc8db5c..16a6844b6 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/util/UtilParticle.java @@ -2,7 +2,6 @@ package mineplex.core.common.util; import java.lang.reflect.Field; -import mineplex.core.common.util.UtilParticle.ParticleType; import net.minecraft.server.v1_7_R3.PacketPlayOutWorldParticles; import org.bukkit.Location; @@ -17,7 +16,7 @@ public class UtilParticle LARGE_EXPLODE("largeexplode"), FIREWORKS_SPARK("fireworksSpark"), BUBBLE("bubble"), - SUSPEND("suspend"), + SUSPEND("suspended"), DEPTH_SUSPEND("depthSuspend"), TOWN_AURA("townaura"), CRIT("crit"), @@ -41,11 +40,12 @@ public class UtilParticle SNOWBALL_POOF("snowballpoof"), DRIP_WATER("dripWater"), DRIP_LAVA("dripLava"), + DROPLET("droplet"), SNOW_SHOVEL("snowshovel"), SLIME("slime"), HEART("heart"), ANGRY_VILLAGER("angryVillager"), - HAPPY_VILLAGER("happerVillager"); + HAPPY_VILLAGER("happyVillager"); public String particleName; diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseFactory.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseFactory.java index 069d4606a..f84a661db 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseFactory.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/DisguiseFactory.java @@ -1,13 +1,63 @@ package mineplex.core.disguise; -import org.bukkit.entity.Entity; +import org.bukkit.entity.*; import mineplex.core.disguise.disguises.*; public class DisguiseFactory { - protected DisguiseZombie DisguiseZombie(Entity entity) + public static DisguiseBase createDisguise(Entity disguised, EntityType disguiseType) { - return new DisguiseZombie(entity); + switch (disguiseType) + { + case BAT: + return new DisguiseBat(disguised); + case BLAZE: + return new DisguiseBlaze(disguised); + case OCELOT: + return new DisguiseCat(disguised); + case CHICKEN: + return new DisguiseChicken(disguised); + case COW: + return new DisguiseCow(disguised); + case CREEPER: + return new DisguiseCreeper(disguised); + case ENDERMAN: + return new DisguiseEnderman(disguised); + case HORSE: + return new DisguiseHorse(disguised); + case IRON_GOLEM: + return new DisguiseIronGolem(disguised); + case MAGMA_CUBE: + return new DisguiseMagmaCube(disguised); + case PIG: + return new DisguisePig(disguised); + case PIG_ZOMBIE: + return new DisguisePigZombie(disguised); + case PLAYER: + return new DisguisePlayer(disguised); + case SHEEP: + return new DisguiseSheep(disguised); + case SKELETON: + return new DisguiseSkeleton(disguised); + case SLIME: + return new DisguiseSlime(disguised); + case SNOWMAN: + return new DisguiseSnowman(disguised); + case SPIDER: + return new DisguiseSpider(disguised); + case SQUID: + return new DisguiseSquid(disguised); + case VILLAGER: + return new DisguiseVillager(disguised); + case WITCH: + return new DisguiseWitch(disguised); + case WOLF: + return new DisguiseWolf(disguised); + case ZOMBIE: + return new DisguiseZombie(disguised); + default: + return null; + } } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java index c1cc364a3..7bc5b5054 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseBase.java @@ -31,11 +31,6 @@ public abstract class DisguiseBase { DataWatcher.watch(0, Entity.getDataWatcher().getByte(0)); DataWatcher.watch(1, Entity.getDataWatcher().getShort(1)); - - if (this instanceof DisguiseEnderman) - { - DataWatcher.watch(0, Byte.valueOf((byte)(DataWatcher.getByte(0) & ~(1 << 0)))); - } } public abstract Packet GetSpawnPacket(); diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java index a6e0374b9..fc7b65e80 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguiseEnderman.java @@ -21,6 +21,13 @@ public class DisguiseEnderman extends DisguiseMonster DataWatcher.watch(8, Byte.valueOf((byte)(PotionBrewer.b(Arrays.asList(new MobEffect(MobEffectList.FIRE_RESISTANCE.id, 777))) ? 1 : 0))); DataWatcher.watch(7, Integer.valueOf(i)); } + + public void UpdateDataWatcher() + { + super.UpdateDataWatcher(); + + DataWatcher.watch(0, Byte.valueOf((byte)(DataWatcher.getByte(0) & ~(1 << 0)))); + } public void SetCarriedId(int i) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java index 62f14c06a..9ff5060a7 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/disguise/disguises/DisguisePlayer.java @@ -10,17 +10,25 @@ import net.minecraft.util.com.mojang.authlib.GameProfile; public class DisguisePlayer extends DisguiseHuman { private String _name; - - public DisguisePlayer(org.bukkit.entity.Entity entity, String name) + + public DisguisePlayer(org.bukkit.entity.Entity entity) { super(entity); + } + + public DisguisePlayer(org.bukkit.entity.Entity entity, String name) + { + this(entity); + setName(name); + } + + public void setName(String name) + { if (name.length() > 16) - { - name = name.substring(0, 16); - } - - _name = name; + _name = name.substring(0, 16); + else + _name = name; } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/energy/Energy.java b/Plugins/Mineplex.Core/src/mineplex/core/energy/Energy.java index 31a8f43f3..e808da221 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/energy/Energy.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/energy/Energy.java @@ -20,6 +20,7 @@ import mineplex.core.energy.event.EnergyEvent.EnergyChangeReason; public class Energy extends MiniClientPlugin { private double _baseEnergy = 180; + private boolean _enabled = true; public Energy(JavaPlugin plugin) { @@ -29,6 +30,9 @@ public class Energy extends MiniClientPlugin @EventHandler public void Update(UpdateEvent event) { + if (!_enabled) + return; + if (event.getType() != UpdateType.TICK) return; @@ -36,7 +40,7 @@ public class Energy extends MiniClientPlugin UpdateEnergy(cur); } - public void UpdateEnergy(Player cur) + private void UpdateEnergy(Player cur) { if (cur.isDead()) return; @@ -57,6 +61,9 @@ public class Energy extends MiniClientPlugin public void ModifyEnergy(Player player, double energy) { + if (!_enabled) + return; + ClientEnergy client = Get(player); if (energy > 0) @@ -124,6 +131,9 @@ public class Energy extends MiniClientPlugin @EventHandler public void handleExp(PlayerExpChangeEvent event) { + if (!_enabled) + return; + event.setAmount(0); } @@ -147,6 +157,11 @@ public class Energy extends MiniClientPlugin protected void loadClientInformation(RetrieveClientInformationEvent event) { } + + public void setEnabled(boolean b) + { + _enabled = b; + } /* ENERGY NO LONGER USED ON ATTACK public void AddEnergySwingMod(Player player, String reason, int amount) diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java index dc0b02f80..a3e7a6543 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/GadgetManager.java @@ -7,6 +7,8 @@ import org.bukkit.Bukkit; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerQuitEvent; import org.bukkit.plugin.java.JavaPlugin; import mineplex.core.MiniPlugin; @@ -14,7 +16,9 @@ import mineplex.core.account.CoreClientManager; import mineplex.core.blockrestore.BlockRestore; import mineplex.core.common.Rank; import mineplex.core.common.util.NautHashMap; +import mineplex.core.common.util.UtilMath; import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilTime; import mineplex.core.disguise.DisguiseManager; import mineplex.core.donation.DonationManager; import mineplex.core.gadget.event.GadgetCollideEntityEvent; @@ -39,6 +43,7 @@ public class GadgetManager extends MiniPlugin private HashSet _gadgets; + private NautHashMap _lastMove = new NautHashMap(); private NautHashMap> _playerActiveGadgetMap = new NautHashMap>(); public GadgetManager(JavaPlugin plugin, CoreClientManager clientManager, DonationManager donationManager, MountManager mountManager, PetManager petManager, PreferencesManager preferencesManager, DisguiseManager disguiseManager, BlockRestore blockRestore) @@ -69,6 +74,16 @@ public class GadgetManager extends MiniPlugin //Morphs _gadgets.add(new MorphBlaze(this)); _gadgets.add(new MorphPumpkinKing(this)); + _gadgets.add(new MorphCreeper(this)); + _gadgets.add(new MorphChicken(this)); + + //Particles + _gadgets.add(new ParticleFireRings(this)); + _gadgets.add(new ParticleRain(this)); + _gadgets.add(new ParticleHelix(this)); + _gadgets.add(new ParticleEnchant(this)); + _gadgets.add(new ParticleGreen(this)); + _gadgets.add(new ParticleFoot(this)); } @EventHandler @@ -118,6 +133,19 @@ public class GadgetManager extends MiniPlugin } } + public void RemoveParticle(Player player) + { + for (Gadget gadget : _gadgets) + { + if (gadget instanceof ParticleGadget) + { + ParticleGadget part = (ParticleGadget)gadget; + + part.Disable(player); + } + } + } + public void DisableAll() { for (Gadget gadget : _gadgets) @@ -168,6 +196,29 @@ public class GadgetManager extends MiniPlugin { return _blockRestore; } + + @EventHandler + public void setMoving(PlayerMoveEvent event) + { + if (UtilMath.offset(event.getFrom(), event.getTo()) <= 0) + return; + + _lastMove.put(event.getPlayer(), System.currentTimeMillis()); + } + + public boolean isMoving(Player player) + { + if (!_lastMove.containsKey(player)) + return false; + + return !UtilTime.elapsed(_lastMove.get(player), 500); + } + + @EventHandler + public void quit(PlayerQuitEvent event) + { + _lastMove.remove(event.getPlayer()); + } public void setActive(Player player, Gadget gadget) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBlaze.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBlaze.java index dae404824..61f9ce90a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBlaze.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/MorphBlaze.java @@ -1,6 +1,7 @@ package mineplex.core.gadget.gadgets; import org.bukkit.Material; +import org.bukkit.Sound; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; import org.bukkit.event.player.PlayerJoinEvent; @@ -62,7 +63,9 @@ public class MorphBlaze extends MorphGadget player.leaveVehicle(); player.eject(); + player.getWorld().playSound(player.getLocation(), Sound.FIZZ, 0.2f, (float)(Math.random())); UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(0, 1, 0), 0.25f, 0.25f, 0.25f, 0f, 3); + UtilParticle.PlayParticle(ParticleType.LARGE_SMOKE, player.getLocation().add(0, 1, 0), 0.1f, 0.1f, 0.1f, 0f, 1); UtilAction.velocity(player, 0.8, 0.1, 1, true); } } diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonMount.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonMount.java index 137d0f9b8..987ac250a 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonMount.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/DragonMount.java @@ -30,7 +30,10 @@ public class DragonMount extends Mount UtilPlayer.message(player, F.main("Mount", "You spawned " + F.elem(GetName()) + ".")); //Store - _active.put(player, new DragonData(this, player)); + DragonData dragonData = new DragonData(this, player); + //Set max health to 1 so player doesn't see a bunch of mount hearts flashing when NewsManager changes the health + dragonData.Dragon.setMaxHealth(1.0); + _active.put(player, dragonData); } @Override diff --git a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/Dragon.java b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/Dragon.java index 2007313c0..49b13b9d9 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/mount/types/Dragon.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/mount/types/Dragon.java @@ -99,7 +99,18 @@ public class Dragon extends DragonMount for (DragonData dragon : GetActive().values()) dragon.Dragon.setCustomName(news); } - + + public void setHealthPercent(double healthPercent) + { + for (DragonData dragon : GetActive().values()) + { + double health = healthPercent * dragon.Dragon.getMaxHealth(); + if (health <= 0.0) + health = 0.001; + dragon.Dragon.setHealth(health); + } + } + @EventHandler public void HeroOwner(PlayerJoinEvent event) { diff --git a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java index 176506241..8f71b331d 100644 --- a/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java +++ b/Plugins/Mineplex.Core/src/mineplex/core/portal/Commands/ServerCommand.java @@ -84,13 +84,6 @@ public class ServerCommand extends CommandBase else deniedAccess = true; } - else if (!servUp.contains("FREE")) - { - if (playerRank.Has(Rank.ULTRA)) - Plugin.SendPlayerToServerWithMessage(player, args[0]); - else - deniedAccess = true; - } else { Plugin.SendPlayerToServerWithMessage(player, args[0]); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java index 8dd6b4ba8..07f242423 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/Hub.java @@ -114,6 +114,7 @@ public class Hub extends JavaPlugin implements IRelation Fire fire = new Fire(this, conditionManager, damage); Teleport teleport = new Teleport(this, clientManager, new Spawn(this)); Energy energy = new Energy(this); + energy.setEnabled(false); ItemFactory itemFactory = new ItemFactory(this, blockRestore, conditionManager, damage, energy, fire, throwManager, webServerAddress); SkillFactory skillManager = new SkillFactory(this, damage, this, combatManager, conditionManager, throwManager, blockRestore, fire, new Movement(this), teleport, energy, webServerAddress); diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java index d2dd6b1fe..2364af280 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/HubManager.java @@ -904,34 +904,6 @@ public class HubManager extends MiniClientPlugin return true; } - @EventHandler - public void HeartDisplay(UpdateEvent event) - { - if (event.getType() != UpdateType.FASTER) - return; - - for (Player player : UtilServer.getPlayers()) - { - if (!player.isOp()) - continue; - - for (Player other : UtilServer.getPlayers()) - { - if (player.getName().equalsIgnoreCase("Chiss")) - UtilParticle.PlayParticle(other, ParticleType.HEART, player.getLocation().add(0, 1, 0), 0.25f, 0.5f, 0.25f, 0, 1); - - else if (player.getName().equalsIgnoreCase("defek7")) - UtilParticle.PlayParticle(other, ParticleType.FIREWORKS_SPARK, player.getLocation().add(0, 1, 0), 0.25f, 0.5f, 0.25f, 0, 2); - - else if (player.getName().equalsIgnoreCase("Spu_")) - UtilParticle.PlayParticle(other, ParticleType.FLAME, player.getLocation().add(0, 1, 0), 0.25f, 0.5f, 0.25f, 0, 2); - - else if (player.getName().equalsIgnoreCase("sterling_")) - UtilParticle.PlayParticle(other, ParticleType.WITCH_MAGIC, player.getLocation().add(0, 1, 0), 0.25f, 0.5f, 0.25f, 0, 2); - } - } - } - @EventHandler public void SkillTrigger(SkillTriggerEvent event) { diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/GadgetManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/GadgetManager.java new file mode 100644 index 000000000..deae5fccd --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/GadgetManager.java @@ -0,0 +1,272 @@ +package mineplex.hub.gadget; + +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Bukkit; +import org.bukkit.ChatColor; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.entity.Projectile; +import org.bukkit.entity.Snowball; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockDamageEvent; +import org.bukkit.event.player.PlayerDropItemEvent; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerMoveEvent; +import org.bukkit.event.player.PlayerQuitEvent; +import org.bukkit.inventory.ItemStack; + +import mineplex.core.MiniPlugin; +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +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.itemstack.ItemStackFactory; +import mineplex.hub.HubManager; +import mineplex.hub.gadget.gadgets.*; +import mineplex.hub.gadget.types.MorphGadget; +import mineplex.hub.gadget.types.MorphGadget.ArmorSlot; +import mineplex.hub.gadget.types.Gadget; +import mineplex.hub.gadget.types.ItemGadget; +import mineplex.hub.gadget.types.ParticleGadget; +import mineplex.hub.gadget.ui.GadgetShop; +import mineplex.hub.mount.MountManager; +import mineplex.hub.pet.PetManager; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; + +public class GadgetManager extends MiniPlugin +{ + public HubManager Manager; + private GadgetShop _gadgetShop; + private PetManager _petManager; + + private HashSet _gadgets; + + private HashMap _lastMove = new HashMap(); + + public GadgetManager(HubManager manager, MountManager mountManager, PetManager petManager) + { + super("Gadget Manager", manager.GetPlugin()); + + Manager = manager; + _petManager = petManager; + + CreateGadgets(); + + _gadgetShop = new GadgetShop(this, mountManager, Manager.GetClients(), Manager.GetDonation()); + } + + private void CreateGadgets() + { + _gadgets = new HashSet(); + + //Items + _gadgets.add(new ItemPaintballGun(this)); + _gadgets.add(new ItemBatGun(this)); + _gadgets.add(new ItemGemBomb(this)); + _gadgets.add(new ItemFirework(this)); + _gadgets.add(new ItemTNT(this)); + + //Morphs + _gadgets.add(new MorphBlaze(this)); + + _gadgets.add(new MorphPumpkinKing(this)); + + _gadgets.add(new MorphCreeper(this)); + + _gadgets.add(new MorphChicken(this)); + + //Particles + _gadgets.add(new ParticleFireRings(this)); + _gadgets.add(new ParticleRain(this)); + _gadgets.add(new ParticleHelix(this)); + _gadgets.add(new ParticleEnchant(this)); + _gadgets.add(new ParticleGreen(this)); + _gadgets.add(new ParticleFoot(this)); + } + + @EventHandler + public void onPlayerJoin(PlayerJoinEvent event) + { + event.getPlayer().getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.CHEST, (byte)0, 1, ChatColor.RESET + C.cGreen + "Gadget Menu")); + + if (Manager.GetClients().Get(event.getPlayer()).GetRank().Has(Rank.MODERATOR)) + { + for (Gadget gadget : _gadgets) + { + Manager.GetDonation().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(gadget.GetName()); + } + } + } + + @EventHandler + public void orderThatChest(final PlayerDropItemEvent event) + { + if (event.getItemDrop().getItemStack().getType() == Material.CHEST) + { + Bukkit.getScheduler().scheduleSyncDelayedTask(GetPlugin(), new Runnable() + { + public void run() + { + if (event.getPlayer().isOnline()) + { + event.getPlayer().getInventory().remove(Material.CHEST); + event.getPlayer().getInventory().setItem(4, ItemStackFactory.Instance.CreateStack(Material.CHEST, (byte)0, 1, ChatColor.RESET + C.cGreen + "Gadget Menu")); + event.getPlayer().updateInventory(); + } + } + }); + } + } + + @EventHandler + public void openShop(PlayerInteractEvent event) + { + if (event.hasItem() && event.getItem().getType() == Material.CHEST) + { + event.setCancelled(true); + + if (!Manager.IsGadgetEnabled()) + { + UtilPlayer.message(event.getPlayer(), F.main("Gadget", "Gadgets are currently disabled.")); + return; + } + + _gadgetShop.attemptShopOpen(event.getPlayer()); + + } + } + + public HashSet getGadgets() + { + return _gadgets; + } + + //Disallows two armor gadgets in same slot. + public void RemoveArmor(Player player, ArmorSlot slot) + { + for (Gadget gadget : _gadgets) + { + if (gadget instanceof MorphGadget) + { + MorphGadget armor = (MorphGadget)gadget; + + if (armor.GetSlot() == slot) + { + armor.RemoveArmor(player); + } + } + } + } + + public void RemoveItem(Player player) + { + for (Gadget gadget : _gadgets) + { + if (gadget instanceof ItemGadget) + { + ItemGadget item = (ItemGadget)gadget; + + item.RemoveItem(player); + } + } + } + + public void RemoveParticle(Player player) + { + for (Gadget gadget : _gadgets) + { + if (gadget instanceof ParticleGadget) + { + ParticleGadget part = (ParticleGadget)gadget; + + part.Disable(player); + } + } + } + + @EventHandler + public void SnowballPickup(BlockDamageEvent event) + { + if (!Manager.Mode.equals("Christmas")) + return; + + if (event.getBlock().getType() != Material.SNOW) + return; + + Player player = event.getPlayer(); + + RemoveItem(player); + + player.getInventory().setItem(3, new ItemStack(Material.SNOW_BALL, 16)); + } + + @EventHandler + public void SnowballHit(CustomDamageEvent event) + { + if (!Manager.Mode.equals("Christmas")) + return; + + Projectile proj = event.GetProjectile(); + if (proj == null) return; + + if (!(proj instanceof Snowball)) + return; + + event.SetCancelled("Snowball Cancel"); + + if (Manager.BumpDisabled(event.GetDamageeEntity())) + return; + + if (Manager.BumpDisabled(event.GetDamagerEntity(true))) + return; + + UtilAction.velocity(event.GetDamageeEntity(), UtilAlg.getTrajectory2d(event.GetDamagerEntity(true), event.GetDamageeEntity()), + 0.4, false, 0, 0.2, 1, false); + + //No Portal + Manager.SetPortalDelay(event.GetDamageeEntity()); + } + + public void DisableAll() + { + for (Gadget gadget : _gadgets) + for (Player player : UtilServer.getPlayers()) + gadget.Disable(player); + } + + public PetManager getPetManager() + { + return _petManager; + } + + @EventHandler + public void setMoving(PlayerMoveEvent event) + { + if (UtilMath.offset(event.getFrom(), event.getTo()) <= 0) + return; + + _lastMove.put(event.getPlayer(), System.currentTimeMillis()); + } + + public boolean isMoving(Player player) + { + if (!_lastMove.containsKey(player)) + return false; + + return !UtilTime.elapsed(_lastMove.get(player), 500); + } + + @EventHandler + public void quit(PlayerQuitEvent event) + { + _lastMove.remove(event.getPlayer()); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/MorphChicken.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/MorphChicken.java new file mode 100644 index 000000000..213d46093 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/MorphChicken.java @@ -0,0 +1,151 @@ +package mineplex.hub.gadget.gadgets; + +import org.bukkit.GameMode; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Egg; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerInteractEvent; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerToggleFlightEvent; +import org.bukkit.util.Vector; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilEvent; +import mineplex.core.common.util.UtilEvent.ActionType; +import mineplex.core.disguise.disguises.DisguiseChicken; +import mineplex.core.recharge.Recharge; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.hub.gadget.GadgetManager; +import mineplex.hub.gadget.types.MorphGadget; + +public class MorphChicken extends MorphGadget +{ + public MorphChicken(GadgetManager manager) + { + super(manager, "Chicken Morph", new String[] + { + C.cWhite + "Soar through the air like an fat Chicken!", + " ", + C.cYellow + "Left Click" + C.cGray + " to use " + C.cGreen + "Egg Shot", + C.cYellow + "Double Jump" + C.cGray + " to use " + C.cGreen + "Flap", + }, + -1, + ArmorSlot.Helmet, Material.FEATHER, (byte)0); + } + + @Override + public void EnableCustom(final Player player) + { + this.ApplyArmor(player); + + DisguiseChicken disguise = new DisguiseChicken(player); + disguise.SetName(player.getName()); + disguise.SetCustomNameVisible(true); + Manager.Manager.GetDisguise().disguise(disguise); + } + + @Override + public void Disable(Player player) + { + this.RemoveArmor(player); + Manager.Manager.GetDisguise().undisguise(player); + } + + @EventHandler + public void Egg(PlayerInteractEvent event) + { + Player player = event.getPlayer(); + + if (!IsActive(player)) + return; + + if (!UtilEvent.isAction(event, ActionType.L)) + return; + + if (!Recharge.Instance.use(player, GetName(), 100, false, false)) + return; + + Vector offset = player.getLocation().getDirection(); + if (offset.getY() < 0) + offset.setY(0); + + Egg egg = player.getWorld().spawn(player.getLocation().add(0, 0.5, 0).add(offset), Egg.class); + egg.setVelocity(player.getLocation().getDirection().add(new Vector(0,0.2,0))); + egg.setShooter(player); + + //Effect + player.getWorld().playSound(player.getLocation(), Sound.CHICKEN_EGG_POP, 0.5f, 1f); + } + + @EventHandler + public void Flap(PlayerToggleFlightEvent event) + { + Player player = event.getPlayer(); + + if (player.getGameMode() == GameMode.CREATIVE) + return; + + if (!IsActive(player)) + return; + + event.setCancelled(true); + player.setFlying(false); + + //Disable Flight + player.setAllowFlight(false); + + double power = 0.4 + (0.5 * player.getExp()); + + //Velocity + UtilAction.velocity(player, player.getLocation().getDirection(), power, true, power, 0, 10, true); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.BAT_TAKEOFF, (float)(0.3 + player.getExp()), (float)(Math.random()/2+1)); + + //Set Recharge + Recharge.Instance.use(player, GetName(), 80, false, false); + + //Energy + player.setExp(Math.max(0f, player.getExp() - (1f/6f))); + } + + @EventHandler + public void FlapUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : GetActive()) + { + if (player.getGameMode() == GameMode.CREATIVE) + continue; + + if (UtilEnt.isGrounded(player) || UtilBlock.solid(player.getLocation().getBlock().getRelative(BlockFace.DOWN))) + { + player.setExp(0.999f); + player.setAllowFlight(true); + } + else if (Recharge.Instance.usable(player, GetName()) && player.getExp() > 0) + { + player.setAllowFlight(true); + } + } + } + + @EventHandler + public void HeroOwner(PlayerJoinEvent event) + { + if (Manager.Manager.GetClients().Get(event.getPlayer()).GetRank().Has(Rank.HERO)) + { + Manager.Manager.GetDonation().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + } + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/MorphCreeper.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/MorphCreeper.java new file mode 100644 index 000000000..5333e2a25 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/MorphCreeper.java @@ -0,0 +1,175 @@ +package mineplex.hub.gadget.gadgets; + +import java.util.HashMap; + +import org.bukkit.EntityEffect; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerJoinEvent; +import org.bukkit.event.player.PlayerQuitEvent; + +import mineplex.core.common.Rank; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilAction; +import mineplex.core.common.util.UtilAlg; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseCreeper; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.hub.gadget.GadgetManager; +import mineplex.hub.gadget.types.MorphGadget; + +public class MorphCreeper extends MorphGadget +{ + private HashMap _active = new HashMap(); + + public MorphCreeper(GadgetManager manager) + { + super(manager, "Creeper Morph", new String[] + { + C.cWhite + "Transforms the wearer into a creepy Creeper!", + " ", + C.cYellow + "Crouch" + C.cGray + " to use " + C.cGreen + "Detonate", + }, + -1, + ArmorSlot.Helmet, Material.SKULL_ITEM, (byte)4); + } + + @Override + public void EnableCustom(final Player player) + { + this.ApplyArmor(player); + + DisguiseCreeper disguise = new DisguiseCreeper(player); + disguise.SetName(player.getName()); + disguise.SetCustomNameVisible(true); + Manager.Manager.GetDisguise().disguise(disguise); + } + + @Override + public void Disable(Player player) + { + this.RemoveArmor(player); + Manager.Manager.GetDisguise().undisguise(player); + } + + @EventHandler + public void Trigger(UpdateEvent event) + { + if (event.getType() == UpdateType.TICK) + { + for (Player player : GetActive()) + { + if (player.isSneaking()) + { + player.leaveVehicle(); + player.eject(); + + if (!_active.containsKey(player)) + _active.put(player, System.currentTimeMillis()); + + double elapsed = (System.currentTimeMillis() - _active.get(player))/1000d; + + player.setExp(Math.min(0.99f, (float)(elapsed/1.5))); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.CREEPER_HISS, (float)(0.5 + elapsed), (float)(0.5 + elapsed)); + + IncreaseSize(player); + } + else if (_active.containsKey(player)) + { + //Unpower + DecreaseSize(player); + + player.setExp(0f); + + double elapsed = (System.currentTimeMillis() - _active.remove(player))/1000d; + + if (elapsed < 1.5) + continue; + + //Explode + UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 0, 0.5f, 0, 0, 1); + player.getWorld().playSound(player.getLocation(), Sound.EXPLODE, 1f, 0.8f); + + player.playEffect(EntityEffect.HURT); + + //Knockback + HashMap players = UtilPlayer.getInRadius(player.getLocation(), 8); + for (Player other : players.keySet()) + { + if (other.equals(player)) + continue; + + double mult = players.get(other); + + //Knockback + UtilAction.velocity(other, UtilAlg.getTrajectory(player.getLocation(), other.getLocation()), 3 * mult, false, 0, 0.5 + 2 * mult, 10, true); + } + } + } + } + } + + + public DisguiseCreeper GetDisguise(Player player) + { + DisguiseBase disguise = Manager.Manager.GetDisguise().getDisguise(player); + if (disguise == null) + return null; + + if (!(disguise instanceof DisguiseCreeper)) + return null; + + return (DisguiseCreeper)disguise; + } + + public int GetSize(Player player) + { + DisguiseCreeper creeper = GetDisguise(player); + if (creeper == null) return 0; + + return creeper.bV(); + } + + public void DecreaseSize(Player player) + { + DisguiseCreeper creeper = GetDisguise(player); + if (creeper == null) return; + + creeper.a(-1); + + Manager.Manager.GetDisguise().updateDisguise(creeper); + } + + public void IncreaseSize(Player player) + { + DisguiseCreeper creeper = GetDisguise(player); + if (creeper == null) return; + + creeper.a(1); + + Manager.Manager.GetDisguise().updateDisguise(creeper); + } + + @EventHandler + public void HeroOwner(PlayerJoinEvent event) + { + if (Manager.Manager.GetClients().Get(event.getPlayer()).GetRank().Has(Rank.HERO)) + { + Manager.Manager.GetDonation().Get(event.getPlayer().getName()).AddUnknownSalesPackagesOwned(GetName()); + } + } + + @EventHandler + public void Clean(PlayerQuitEvent event) + { + _active.remove(event.getPlayer()); + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/ParticleEnchant.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/ParticleEnchant.java new file mode 100644 index 000000000..d7e5ce9e6 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/ParticleEnchant.java @@ -0,0 +1,49 @@ +package mineplex.hub.gadget.gadgets; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.hub.gadget.GadgetManager; +import mineplex.hub.gadget.types.ParticleGadget; + +public class ParticleEnchant extends ParticleGadget +{ + + public ParticleEnchant(GadgetManager manager) + { + super(manager, "Enchanted", new String[] + { + C.cWhite + "The wisdom of the universe", + C.cWhite + "suddenly finds you extremely", + C.cWhite + "attractive, and wants to", + C.cWhite + "\'enchant\' you.", + }, + -1, + Material.BOOK, (byte)0); + } + + @EventHandler + public void playParticle(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : GetActive()) + { + if (Manager.isMoving(player)) + { + UtilParticle.PlayParticle(ParticleType.ENCHANTMENT_TABLE, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4); + } + else + { + UtilParticle.PlayParticle(ParticleType.ENCHANTMENT_TABLE, player.getLocation().add(0, 1.4, 0), 0f, 0f, 0f, 1, 4); + } + } + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/ParticleFireRings.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/ParticleFireRings.java new file mode 100644 index 000000000..a637727b2 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/ParticleFireRings.java @@ -0,0 +1,74 @@ +package mineplex.hub.gadget.gadgets; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.hub.gadget.GadgetManager; +import mineplex.hub.gadget.types.ParticleGadget; + +public class ParticleFireRings extends ParticleGadget +{ + + public ParticleFireRings(GadgetManager manager) + { + super(manager, "Flame Rings", new String[] + { + C.cWhite + "Forged from the burning ashes", + C.cWhite + "of 1000 Blazes by the infamous", + C.cWhite + "Flame King of the Nether realm.", + }, + -1, + Material.BLAZE_POWDER, (byte)0); + } + + @EventHandler + public void playParticle(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : GetActive()) + { + if (Manager.isMoving(player)) + { + UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(0, 1f, 0), 0.2f, 0.2f, 0.2f, 0, 1); + } + else + { + for (int i=0 ; i < 1 ; i++) + { + double lead = i * ((2d * Math.PI)/2); + + float x = (float) (Math.sin(player.getTicksLived()/5d + lead) * 1f); + float z = (float) (Math.cos(player.getTicksLived()/5d + lead) * 1f); + + float y = (float) (Math.sin(player.getTicksLived()/5d + lead) + 1f); + + UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(x, y, z), 0f, 0f, 0f, 0, 1); + } + + for (int i=0 ; i < 1 ; i++) + { + double lead = i * ((2d * Math.PI)/2); + + float x = (float) -(Math.sin(player.getTicksLived()/5d + lead) * 1f); + float z = (float) (Math.cos(player.getTicksLived()/5d + lead) * 1f); + + float y = (float) (Math.sin(player.getTicksLived()/5d + lead) + 1f); + + UtilParticle.PlayParticle(ParticleType.FLAME, player.getLocation().add(x, y, z), 0f, 0f, 0f, 0, 1); + } + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.FIRE, 0.2f, 1f); + } + } + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/ParticleFoot.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/ParticleFoot.java new file mode 100644 index 000000000..a8e9bd4b6 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/ParticleFoot.java @@ -0,0 +1,119 @@ +package mineplex.hub.gadget.gadgets; + +import java.util.HashMap; +import java.util.Iterator; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.util.Vector; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilBlock; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilTime; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.hub.gadget.GadgetManager; +import mineplex.hub.gadget.types.ParticleGadget; + +public class ParticleFoot extends ParticleGadget +{ + private boolean _foot = false; + + private HashMap _steps = new HashMap(); + + public ParticleFoot(GadgetManager manager) + { + super(manager, "Shadow Walk", new String[] + { + C.cWhite + "In a world where footprints", + C.cWhite + "do not exist, leaving your", + C.cWhite + "shadow behind is the next", + C.cWhite + "best thing.", + }, + -1, + Material.LEATHER_BOOTS, (byte)0); + } + + @EventHandler + public void playParticle(UpdateEvent event) + { + if (event.getType() != UpdateType.FASTEST) + return; + + _foot = !_foot; + + cleanSteps(); + + for (Player player : GetActive()) + { + if (!Manager.isMoving(player)) + continue; + + if (!UtilEnt.isGrounded(player)) + continue; + + Vector offset; + + Vector dir = player.getLocation().getDirection(); + dir.setY(0); + dir.normalize(); + + if (_foot) + { + offset = new Vector(dir.getZ() * -1, 0.1, dir.getX()); + } + else + { + offset = new Vector(dir.getZ(), 0.1, dir.getX() * -1); + } + + Location loc = player.getLocation().add(offset.multiply(0.2)); + + if (nearStep(loc)) + continue; + + if (!UtilBlock.solid(loc.getBlock().getRelative(BlockFace.DOWN))) + continue; + + _steps.put(loc, System.currentTimeMillis()); + + UtilParticle.PlayParticle(ParticleType.FOOTSTEP, loc, 0f, 0f, 0f, 0, 1); + } + } + + public void cleanSteps() + { + if (_steps.isEmpty()) + return; + + Iterator stepIterator = _steps.keySet().iterator(); + + while (stepIterator.hasNext()) + { + Location step = stepIterator.next(); + long time = _steps.get(step); + + if (UtilTime.elapsed(time, 10000)) + stepIterator.remove(); + } + } + + public boolean nearStep(Location loc) + { + for (Location other : _steps.keySet()) + { + if (UtilMath.offset(loc, other) < 0.3) + return true; + } + + return false; + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/ParticleGreen.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/ParticleGreen.java new file mode 100644 index 000000000..c9847e0c3 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/ParticleGreen.java @@ -0,0 +1,52 @@ +package mineplex.hub.gadget.gadgets; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.hub.gadget.GadgetManager; +import mineplex.hub.gadget.types.ParticleGadget; + +public class ParticleGreen extends ParticleGadget +{ + + public ParticleGreen(GadgetManager manager) + { + super(manager, "Green Ring", new String[] + { + C.cWhite + "With these sparkles, you", + C.cWhite + "can now sparkle while you", + C.cWhite + "sparkle with CaptainSparklez.", + }, + -1, + Material.EMERALD, (byte)0); + } + + @EventHandler + public void playParticle(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : GetActive()) + { + if (Manager.isMoving(player)) + { + UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().add(0, 1f, 0), 0f, 0f, 0f, 0, 1); + } + else + { + float x = (float) (Math.sin(player.getTicksLived()/5d) * 1f); + float z = (float) (Math.cos(player.getTicksLived()/5d) * 1f); + + UtilParticle.PlayParticle(ParticleType.HAPPY_VILLAGER, player.getLocation().add(x, 1, z), 0f, 0f, 0f, 0, 1); + } + } + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/ParticleHelix.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/ParticleHelix.java new file mode 100644 index 000000000..cfd272dfc --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/ParticleHelix.java @@ -0,0 +1,71 @@ +package mineplex.hub.gadget.gadgets; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.hub.gadget.GadgetManager; +import mineplex.hub.gadget.types.ParticleGadget; + +public class ParticleHelix extends ParticleGadget +{ + + public ParticleHelix(GadgetManager manager) + { + super(manager, "Blood Helix", new String[] + { + C.cWhite + "Ancient legend says this magic", + C.cWhite + "empowers the blood of its user,", + C.cWhite + "giving them godly powers.", + }, + -1, + Material.REDSTONE, (byte)0); + } + + @EventHandler + public void playParticle(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : GetActive()) + { + if (Manager.isMoving(player)) + { + UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4); + } + else + { + for (int height=0 ; height <= 20 ; height++) + { + for (int i=0 ; i < 2 ; i++) + { + double lead = i * ((2d * Math.PI)/2); + + double heightLead = height * ((2d * Math.PI)/20); + + float x = (float) (Math.sin(player.getTicksLived()/20d + lead + heightLead) * 1.2f); + float z = (float) (Math.cos(player.getTicksLived()/20d + lead + heightLead) * 1.2f); + + float y = 0.15f * height; + + UtilParticle.PlayParticle(ParticleType.RED_DUST, player.getLocation().add(x * (1d - height/22d), y, z * (1d - height/22d)), 0f, 0f, 0f, 0, 1); + + + } + } + + //UtilParticle.PlayParticle(ParticleType.LAVA, player.getLocation().add(0, 3, 0), 0f, 0f, 0f, 0, 2); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.LAVA, 0.3f, 1f); + } + } + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/ParticleRain.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/ParticleRain.java new file mode 100644 index 000000000..a5e21b381 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/gadgets/ParticleRain.java @@ -0,0 +1,59 @@ +package mineplex.hub.gadget.gadgets; + +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; +import mineplex.core.common.util.UtilParticle.ParticleType; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.hub.gadget.GadgetManager; +import mineplex.hub.gadget.types.ParticleGadget; + +public class ParticleRain extends ParticleGadget +{ + + public ParticleRain(GadgetManager manager) + { + super(manager, "Rain Cloud", new String[] + { + C.cWhite + "Your very own rain cloud!", + C.cWhite + "Now you never have to worry", + C.cWhite + "about not being wet. Woo...", + }, + -1, + Material.INK_SACK, (byte)4); + } + + @EventHandler + public void playParticle(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : GetActive()) + { + if (Manager.isMoving(player)) + { + UtilParticle.PlayParticle(ParticleType.SPLASH, player.getLocation().add(0, 1, 0), 0.2f, 0.2f, 0.2f, 0, 4); + } + else + { + UtilParticle.PlayParticle(player, ParticleType.EXPLODE, player.getLocation().add(0, 3.5, 0), 0.6f, 0f, 0.6f, 0, 8); + + for (Player other : UtilServer.getPlayers()) + if (!player.equals(other)) + UtilParticle.PlayParticle(other, ParticleType.CLOUD, player.getLocation().add(0, 3.5, 0), 0.6f, 0.1f, 0.6f, 0, 8); + + UtilParticle.PlayParticle(ParticleType.DRIP_WATER, player.getLocation().add(0, 3.5, 0), 0.4f, 0.1f, 0.4f, 0, 2); + + //Sound + player.getWorld().playSound(player.getLocation(), Sound.AMBIENCE_RAIN, 0.1f, 1f); + } + } + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/types/ParticleGadget.java b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/types/ParticleGadget.java new file mode 100644 index 000000000..0406bfef2 --- /dev/null +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/gadget/types/ParticleGadget.java @@ -0,0 +1,47 @@ +package mineplex.hub.gadget.types; + +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.player.PlayerCommandPreprocessEvent; + +import mineplex.core.common.util.F; +import mineplex.core.common.util.UtilPlayer; +import mineplex.hub.gadget.GadgetManager; + +public abstract class ParticleGadget extends Gadget +{ + + + public ParticleGadget(GadgetManager manager, String name, String[] desc, int cost, Material mat, byte data) + { + super(manager, name, desc, cost, mat, data); + } + + @Override + public void EnableCustom(Player player) + { + Manager.RemoveParticle(player); + + _active.add(player); + + UtilPlayer.message(player, F.main("Gadget", "You summoned " + F.elem(GetName()) + ".")); + } + + @Override + public void Disable(Player player) + { + if (_active.remove(player)) + UtilPlayer.message(player, F.main("Gadget", "You unsummoned " + F.elem(GetName()) + ".")); + } + + @EventHandler + public void Trigger(PlayerCommandPreprocessEvent event) + { + if (event.getMessage().toLowerCase().contains(GetDisplayName().toLowerCase())) + { + this.Enable(event.getPlayer()); + event.setCancelled(true); + } + } +} diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java index 0c1c37cb5..7b75571e5 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/JumpManager.java @@ -15,6 +15,9 @@ import mineplex.core.common.util.UtilBlock; import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilPlayer; import mineplex.core.common.util.UtilServer; +import mineplex.core.disguise.disguises.DisguiseBase; +import mineplex.core.disguise.disguises.DisguiseChicken; +import mineplex.core.disguise.disguises.DisguiseCreeper; import mineplex.core.updater.UpdateType; import mineplex.core.updater.event.UpdateEvent; import mineplex.hub.HubManager; @@ -37,7 +40,12 @@ public class JumpManager extends MiniPlugin if (player.getGameMode() == GameMode.CREATIVE) return; - + + //Chicken Cancel + DisguiseBase disguise = Manager.GetDisguise().getDisguise(player); + if (disguise != null && disguise instanceof DisguiseChicken) + return; + event.setCancelled(true); player.setFlying(false); @@ -78,5 +86,4 @@ public class JumpManager extends MiniPlugin } } } - } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java index c121ae83a..c0cbf673c 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/modules/NewsManager.java @@ -246,15 +246,17 @@ public class NewsManager extends MiniPlugin String text = col + C.Bold + "MINEPLEX" + ChatColor.RESET + " - " + _news[_newsIndex]; if (text.length() > 64) text = text.substring(0, 64); - + + double healthPercent = (double)_newsIndex/(double)(_news.length-1); for (Player player : UtilServer.getPlayers()) - UtilDisplay.displayTextBar(Manager.GetPlugin(), player, (double)_newsIndex/(double)(_news.length-1), text); + UtilDisplay.displayTextBar(Manager.GetPlugin(), player, healthPercent, text); for (Mount mount : Manager.GetMount().getMounts()) { if (mount instanceof Dragon) { ((Dragon)mount).SetName(text); + ((Dragon)mount).setHealthPercent(healthPercent); } } } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java index 07f1f4fd6..688cc034a 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerInfo.java @@ -9,9 +9,4 @@ public class ServerInfo public String Map; public String ServerType; public String Game; - - public boolean isFree() - { - return Name.contains("FREE"); - } } \ No newline at end of file diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java index 2dd463663..5a9e69501 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ServerManager.java @@ -62,7 +62,7 @@ import mineplex.hub.server.ui.ServerNpcShop; public class ServerManager extends MiniPlugin { - private static final Long FREE_PORTAL_TIMER = 20000L; + private static final Long FREE_PORTAL_TIMER = 35000L; private CoreClientManager _clientManager; private DonationManager _donationManager; @@ -192,10 +192,6 @@ public class ServerManager extends MiniPlugin { if ((serverInfo.MOTD.contains("Starting") || serverInfo.MOTD.contains("Recruiting") || serverInfo.MOTD.contains("Waiting") || serverInfo.MOTD.contains("Cup")) && (serverInfo.MaxPlayers - serverInfo.CurrentPlayers) >= slots) { - // Make sure ultra players get put on premium servers, non premium gets placed on free servers - if (hasUltra == serverInfo.isFree()) - continue; - SelectServer(player, serverInfo); return; } diff --git a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java index 267cf786e..451a4d43a 100644 --- a/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java +++ b/Plugins/Mineplex.Hub/src/mineplex/hub/server/ui/ServerNpcPage.java @@ -26,7 +26,6 @@ public class ServerNpcPage extends ShopPageBase im { // Shop Item Messages private static final String MESSAGE_SHOP_URL = ChatColor.RESET + "www.mineplex.com/shop"; - private static final String MESSAGE_REQUIRES_PREMIUM = ChatColor.RESET + C.cRed + "Premium requires " + Rank.ULTRA.GetTag(false, false) + C.cRed + " or " + Rank.HERO.GetTag(false, false); private static final String MESSAGE_BETA_GET_ULTRA = ChatColor.RESET + C.Line + "Get Ultra to join Beta servers!"; private static final String MESSAGE_JOIN = ChatColor.RESET + C.Line + "Click to Join"; private static final String MESSAGE_IN_PROGRESS = ChatColor.RESET + C.Line + "Game in Progress."; @@ -37,8 +36,7 @@ public class ServerNpcPage extends ShopPageBase im private String _serverNpcKey; private boolean _onMainPage = true; - private boolean _freeOnly; - + public ServerNpcPage(ServerManager plugin, ServerNpcShop shop, CoreClientManager clientManager, DonationManager donationManager, String name, Player player, String serverNpcKey) { super(plugin, shop, clientManager, donationManager, name, player, 54); @@ -76,7 +74,7 @@ public class ServerNpcPage extends ShopPageBase im } else { - buildInProgressServerPage(serverList, _freeOnly, slotsNeeded); + buildInProgressServerPage(serverList, slotsNeeded); } } @@ -93,13 +91,13 @@ public class ServerNpcPage extends ShopPageBase im ChatColor.RESET + C.cYellow + "Free players must wait a short time", ChatColor.RESET + C.cYellow + "to help lighten the load on our servers.", ChatColor.RESET + "", - ChatColor.RESET + C.cAqua + "Ultra and Hero players have instant", - ChatColor.RESET + C.cAqua + "access to free and premium servers!", + ChatColor.RESET + C.cAqua + "Ultra and Hero players have", + ChatColor.RESET + C.cAqua + "instant access to our servers!", ChatColor.RESET + "", ChatColor.RESET + "Visit " + C.cGreen + "www.mineplex.com/shop" + C.cWhite + " for Premium!" }, seconds, false, false); - AddItem(20, item); + AddItem(22, item); } private void clearPage() @@ -114,14 +112,13 @@ public class ServerNpcPage extends ShopPageBase im { boolean ownsUltraPackage = DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA); Material status = Material.REDSTONE_BLOCK; - boolean free = serverInfo.isFree(); List lore = new ArrayList(); String inProgress = (serverInfo.Game == null || serverInfo.ServerType.equalsIgnoreCase("Competitive")) ? MESSAGE_IN_PROGRESS : MESSAGE_SPECTATE; String wait = (serverInfo.Game == null || serverInfo.ServerType.equalsIgnoreCase("Competitive")) ? null : MESSAGE_WAIT; if (isStarting(serverInfo) && (serverInfo.MaxPlayers - serverInfo.CurrentPlayers) >= slotsNeeded) - status = free ? Material.EMERALD_BLOCK : Material.DIAMOND_BLOCK; + status = Material.EMERALD_BLOCK; else if (isInProgress(serverInfo)) status = Material.GOLD_BLOCK; @@ -135,10 +132,7 @@ public class ServerNpcPage extends ShopPageBase im lore.add(ChatColor.RESET + C.cYellow + "Players: " + C.cWhite + serverInfo.CurrentPlayers + "/" + serverInfo.MaxPlayers); lore.add(ChatColor.RESET + ""); - - // Only show motd if the player has access - if (free || ownsUltraPackage) - lore.add(ChatColor.RESET + serverInfo.MOTD); + lore.add(ChatColor.RESET + serverInfo.MOTD); if (serverInfo.Name.contains("BETA") && !ownsUltraPackage) { @@ -164,13 +158,7 @@ public class ServerNpcPage extends ShopPageBase im { if (!ownsUltraPackage) { - if (free) - lore.add(MESSAGE_FULL_GET_ULTRA); - else - { - lore.add(MESSAGE_REQUIRES_PREMIUM); - lore.add(MESSAGE_SHOP_URL); - } + lore.add(MESSAGE_FULL_GET_ULTRA); } else { @@ -183,8 +171,6 @@ public class ServerNpcPage extends ShopPageBase im } else { - if (free || ownsUltraPackage) - { if (serverInfo.CurrentPlayers >= serverInfo.MaxPlayers && !ownsUltraPackage) { lore.add(MESSAGE_FULL_GET_ULTRA); @@ -193,26 +179,18 @@ public class ServerNpcPage extends ShopPageBase im { lore.add(MESSAGE_JOIN); } - } - else - { - lore.add(MESSAGE_REQUIRES_PREMIUM); - lore.add(MESSAGE_SHOP_URL); - } } } - return new ShopItem(status, ChatColor.RESET + C.Line + C.Bold + (free ? C.cGreen + "Free Server " : C.cAqua + "Premium Server ") + serverInfo.Name.split("-")[1], lore.toArray(new String[lore.size()]), serverInfo.CurrentPlayers, false); + return new ShopItem(status, ChatColor.RESET + C.cGreen + C.Line + C.Bold + "Server " + serverInfo.Name.split("-")[1], lore.toArray(new String[lore.size()]), serverInfo.CurrentPlayers, false); } private void buildAvailableServerPage(List serverList, int slotsNeeded) { + int serversToShow = 5; int greenCount = 0; - int blueCount = 0; - int yellowFreeCount = 0; - int yellowUltraCount = 0; - int greenStartSlot = 19; - int blueStartSlot = 23; + int yellowCount = 0; + int greenStartSlot = 18 + ((9 - serversToShow) / 2); boolean showGreen = true; long portalTime = Plugin.getMillisecondsUntilPortal(Player); @@ -224,73 +202,42 @@ public class ServerNpcPage extends ShopPageBase im for (ServerInfo serverInfo : serverList) { - boolean free = serverInfo.isFree(); - int slot = (free ? greenCount + greenStartSlot : blueCount + blueStartSlot); + int slot = greenCount + greenStartSlot; - if (isStarting(serverInfo) && hasEnoughSlots(serverInfo, slotsNeeded) && (free ? greenCount : blueCount) < 3) + if (isStarting(serverInfo) && hasEnoughSlots(serverInfo, slotsNeeded) && greenCount < serversToShow) { - if ((free && showGreen) || !free) + if (showGreen) { ShopItem shopItem = buildShopItem(serverInfo, slotsNeeded); - if (free) - greenCount++; - else - blueCount++; + greenCount++; AddButton(slot, shopItem, new JoinServerButton(this, serverInfo)); } } else if (isInProgress(serverInfo)) { - if (free) - yellowFreeCount++; - else - yellowUltraCount++; + yellowCount++; } } -// AddItem(11, new ShopItem(Material.IRON_BLOCK, C.cGreen + "Free Servers", new String[] {C.cGray + "Anyone can play!" }, 1, false)); -// AddItem(15, new ShopItem(Material.IRON_BLOCK, C.cBlue + "Premium Servers", new String[] {C.cGray + "Available to " + Rank.ULTRA.GetTag(true, true) + ChatColor.RESET + C.cGray + " and " + Rank.HERO.GetTag(true, true) + ChatColor.RESET + C.cGray + "!" }, 1, false)); - AddButton(38, new ShopItem(Material.GOLD_BLOCK, C.cGreen + yellowFreeCount + " Games In Progress", new String[]{MESSAGE_SPECTATE}, yellowFreeCount > 64 ? 1 : yellowFreeCount, false), new SingleButton() - { - @Override - public void Clicked(Player player) - { - long portalTime = Plugin.getMillisecondsUntilPortal(Player); - if (portalTime <= 0) - { - _onMainPage = false; - _freeOnly = true; - } - else - { - PlayDenySound(Player); - } - } - }); - AddButton(42, new ShopItem(Material.GOLD_BLOCK, C.cAqua + yellowUltraCount + " Games In Progress", new String[]{MESSAGE_SPECTATE}, yellowUltraCount > 64 ? 1 : yellowUltraCount, false), new SingleButton() + AddButton(40, new ShopItem(Material.GOLD_BLOCK, C.cAqua + yellowCount++ + " Games In Progress", new String[]{MESSAGE_SPECTATE}, yellowCount > 64 ? 1 : yellowCount, false), new SingleButton() { @Override public void Clicked(Player player) { _onMainPage = false; - _freeOnly = false; } }); // Clear empty slots if (showGreen) { - for (int i = greenCount + greenStartSlot; i < greenStartSlot + 3; i++) + for (int i = greenCount + greenStartSlot; i < greenStartSlot + serversToShow; i++) { setItem(i, null); } } - for (int i = blueCount + blueStartSlot; i < blueStartSlot + 3; i++) - { - setItem(i, null); - } } private boolean isStarting(ServerInfo serverInfo) @@ -308,13 +255,13 @@ public class ServerNpcPage extends ShopPageBase im return (serverInfo.MaxPlayers - serverInfo.CurrentPlayers) >= slotsNeeded; } - private void buildInProgressServerPage(List serverList, boolean freeOnly, int slotsNeeded) + private void buildInProgressServerPage(List serverList, int slotsNeeded) { int slot = 9; for (ServerInfo serverInfo : serverList) { - if (isInProgress(serverInfo) && serverInfo.isFree() == freeOnly && slot < getSize()) + if (isInProgress(serverInfo) && slot < getSize()) { ShopItem shopItem = buildShopItem(serverInfo, slotsNeeded); @@ -351,7 +298,7 @@ public class ServerNpcPage extends ShopPageBase im { int slots = Plugin.GetRequiredSlots(player, serverInfo.ServerType); - if ((serverInfo.Name.contains("BETA") && !Client.GetRank().Has(Rank.ULTRA)) || (!serverInfo.isFree() && !(DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA))) || (serverInfo.MaxPlayers - serverInfo.CurrentPlayers < slots && !(DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA)))) + if ((serverInfo.Name.contains("BETA") && !Client.GetRank().Has(Rank.ULTRA)) || (serverInfo.MaxPlayers - serverInfo.CurrentPlayers < slots && !(DonationManager.Get(Player.getName()).OwnsUnknownPackage(serverInfo.ServerType + " ULTRA") || Client.GetRank().Has(Rank.ULTRA)))) { PlayDenySound(player); return; diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java index 2c5a5acde..7c4d836f7 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/GameType.java @@ -26,6 +26,7 @@ public enum GameType Horse("Horseback"), SurvivalGames("Survival Games"), SurvivalGamesTeams("Survival Games Teams"), + Micro("Micro Battle"), MineWare("MineWare"), MilkCow("Milk the Cow"), Paintball("Super Paintball"), @@ -37,11 +38,13 @@ public enum GameType SmashTeams("Super Smash Mobs Teams", "Super Smash Mobs"), SmashDomination("Super Smash Mobs Domination", "Super Smash Mobs"), Snake("Snake"), + SneakyAssassins("Sneaky Assassins"), SnowFight("Snow Fight"), Spleef("Super Spleef"), SpleefTeams("Super Spleef Teams"), Stacker("Super Stacker"), SquidShooter("Squid Shooter"), + Tug("Tug of Wool"), TurfWars("Turf Wars"), UHC("Ultra Hardcore"), ZombieSurvival("Zombie Survival"); diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java index e68b9941a..c545f0c3b 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/MapParser.java @@ -639,7 +639,11 @@ public class MapParser extends JavaPlugin implements Listener public void Updates(PlayerMoveEvent event) { for (World world : this.getServer().getWorlds()) + { world.setTime(8000); + world.setStorm(false); + } + if (event.getPlayer().getGameMode() != GameMode.CREATIVE) event.getPlayer().setGameMode(GameMode.CREATIVE); diff --git a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/Parse.java b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/Parse.java index 9ea4f381f..ed6b13e64 100644 --- a/Plugins/Mineplex.MapParser/src/mineplex/mapparser/Parse.java +++ b/Plugins/Mineplex.MapParser/src/mineplex/mapparser/Parse.java @@ -29,7 +29,7 @@ public class Parse private String[] _args; private Location _callLoc; - private int _size = 50; + private int _size = 500; private int _x = 0; private int _y = 0; private int _z = 0; @@ -57,6 +57,9 @@ public class Parse _callLoc = new Location(world, loc.getX(), loc.getY(), loc.getZ()); _mapData = data; + + for (String arg : args) + Host.Announce("Parse Arg: " + F.elem(arg)); Initialize(); } @@ -309,10 +312,10 @@ public class Parse if (wool.getData() == 11) { - if (!_teamLocs.containsKey("DBlue")) - _teamLocs.put("DBlue", new ArrayList()); + if (!_teamLocs.containsKey("Blue")) + _teamLocs.put("Blue", new ArrayList()); - _teamLocs.get("DBlue").add(wool.getLocation()); + _teamLocs.get("Blue").add(wool.getLocation()); //Remove Blocks block.setTypeId(0); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameFactory.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameFactory.java index a14cf6a8a..2de9d7e55 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameFactory.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameFactory.java @@ -24,6 +24,7 @@ import nautilus.game.arcade.game.games.evolution.Evolution; import nautilus.game.arcade.game.games.gravity.Gravity; import nautilus.game.arcade.game.games.halloween.Halloween; import nautilus.game.arcade.game.games.hideseek.HideSeek; +import nautilus.game.arcade.game.games.micro.Micro; import nautilus.game.arcade.game.games.milkcow.MilkCow; import nautilus.game.arcade.game.games.mineware.MineWare; import nautilus.game.arcade.game.games.quiver.Quiver; @@ -76,6 +77,7 @@ public class GameFactory else if (gameType == GameType.Gravity) return new Gravity(_manager); else if (gameType == GameType.Halloween) return new Halloween(_manager); else if (gameType == GameType.HideSeek) return new HideSeek(_manager); + else if (gameType == GameType.Micro) return new Micro(_manager); else if (gameType == GameType.MineWare) return new MineWare(_manager); else if (gameType == GameType.MilkCow) return new MilkCow(_manager); else if (gameType == GameType.Paintball) return new Paintball(_manager); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java index daba02784..85a4488d0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/GameType.java @@ -26,6 +26,7 @@ public enum GameType Horse("Horseback"), SurvivalGames("Survival Games"), SurvivalGamesTeams("Survival Games Teams"), + Micro("Micro Battle"), MineWare("MineWare"), MilkCow("Milk the Cow"), Paintball("Super Paintball"), diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/CompassAddon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/CompassAddon.java index 666e15509..fe6ab72f4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/CompassAddon.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/addons/CompassAddon.java @@ -2,6 +2,7 @@ package nautilus.game.arcade.addons; import java.util.HashSet; +import org.bukkit.GameMode; import org.bukkit.Material; import org.bukkit.entity.Player; import org.bukkit.event.EventHandler; @@ -84,7 +85,7 @@ public class CompassAddon extends MiniPlugin if (target != null) { - if (Manager.GetGame().CompassGiveItem) + if (Manager.GetGame().CompassGiveItem || player.getGameMode() == GameMode.SURVIVAL) if (!player.getInventory().contains(Material.COMPASS)) { if (player.getOpenInventory() == null || player.getOpenInventory().getCursor() == null || player.getOpenInventory().getCursor().getType() != Material.COMPASS) 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 0f24f3ea7..d4b014c77 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 @@ -246,6 +246,11 @@ public abstract class Game implements Listener System.out.println("Loading " + GetName() + "..."); } + public void setKits(Kit[] kits) + { + _kits = kits; + } + public ArrayList GetFiles() { return _files; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java index 1dc2f49b5..04142345d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/TeamGame.java @@ -230,6 +230,9 @@ public abstract class TeamGame extends Game //Display Individual Players if (this.GetPlayers(true).size() < 13) { + if (!team.IsTeamAlive()) + continue; + Scoreboard.WriteBlank(); for (Player player : team.GetPlayers(true)) diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java index 4bb71b3f5..4bde091c9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/BaconBrawl.java @@ -74,7 +74,7 @@ public class BaconBrawl extends SoloGame if (event.GetCause() == DamageCause.ENTITY_ATTACK || event.GetCause() == DamageCause.CUSTOM || event.GetCause() == DamageCause.PROJECTILE) { event.GetDamageeEntity().setHealth(event.GetDamageeEntity().getMaxHealth()); - event.AddKnockback("Pig Wrestle", 2); + event.AddKnockback("Pig Wrestle", 1.5 + (GetStateTime() / 60000d)); } } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitBabyPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitBabyPig.java index e6a3c6e05..54a64f6d4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitBabyPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitBabyPig.java @@ -65,7 +65,7 @@ public class KitBabyPig extends Kit LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type); entity.setRemoveWhenFarAway(false); - entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit" + (GetAvailability() == KitAvailability.Blue ? ChatColor.GRAY + " (" + ChatColor.WHITE + "Ultra" + ChatColor.GRAY + ")" : "")); + entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit"); entity.setCustomNameVisible(true); entity.getEquipment().setItemInHand(_itemInHand); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java index aff9daf13..6ca35322f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/baconbrawl/kits/KitSheepPig.java @@ -26,7 +26,7 @@ public class KitSheepPig extends Kit { public KitSheepPig(ArcadeManager manager) { - super(manager, "'Pig'", KitAvailability.Blue, + super(manager, "'Pig'", KitAvailability.Green, 5000, new String[] { @@ -65,7 +65,7 @@ public class KitSheepPig extends Kit LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type); entity.setRemoveWhenFarAway(false); - entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit" + (GetAvailability() == KitAvailability.Blue ? ChatColor.GRAY + " (" + ChatColor.WHITE + "Ultra" + ChatColor.GRAY + ")" : "")); + entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit"); entity.setCustomNameVisible(true); entity.getEquipment().setItemInHand(_itemInHand); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBomber.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBomber.java index d87639e7a..ff265513c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBomber.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/barbarians/kits/KitBomber.java @@ -18,7 +18,7 @@ public class KitBomber extends Kit { public KitBomber(ArcadeManager manager) { - super(manager, "Bomber", KitAvailability.Blue, + super(manager, "Bomber", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBomber.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBomber.java index 5d2da9ccd..b2d9cf1d3 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBomber.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitBomber.java @@ -15,7 +15,7 @@ public class KitBomber extends Kit { public KitBomber(ArcadeManager manager) { - super(manager, "Bomber", KitAvailability.Blue, + super(manager, "Bomber", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitMiner.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitMiner.java index 619775db5..032384e02 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitMiner.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/bridge/kits/KitMiner.java @@ -16,7 +16,7 @@ public class KitMiner extends Kit { public KitMiner(ArcadeManager manager) { - super(manager, "Miner", KitAvailability.Blue, + super(manager, "Miner", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanAssassin.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanAssassin.java index 9304884ec..1672de6ee 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanAssassin.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanAssassin.java @@ -23,7 +23,7 @@ public class KitHumanAssassin extends Kit { public KitHumanAssassin(ArcadeManager manager) { - super(manager, "Castle Assassin", KitAvailability.Blue, + super(manager, "Castle Assassin", KitAvailability.Green, 5000, new String[] { "Able to kill with a single shot!" diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanBrawler.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanBrawler.java index 1cc641bba..7d2bcd633 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanBrawler.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitHumanBrawler.java @@ -22,7 +22,7 @@ public class KitHumanBrawler extends Kit { public KitHumanBrawler(ArcadeManager manager) { - super(manager, "Castle Brawler", KitAvailability.Blue, + super(manager, "Castle Brawler", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadZombie.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadZombie.java index 95d1cd22c..51324bf46 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadZombie.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/castlesiege/kits/KitUndeadZombie.java @@ -19,7 +19,7 @@ public class KitUndeadZombie extends Kit { public KitUndeadZombie(ArcadeManager manager) { - super(manager, "Undead Zombie", KitAvailability.Blue, + super(manager, "Undead Zombie", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitRunnerTraitor.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitRunnerTraitor.java index 502628695..5c62b702d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitRunnerTraitor.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/deathtag/kits/KitRunnerTraitor.java @@ -16,7 +16,7 @@ public class KitRunnerTraitor extends Kit { public KitRunnerTraitor(ArcadeManager manager) { - super(manager, "Runner Traitor", KitAvailability.Blue, + super(manager, "Runner Traitor", KitAvailability.Green, 5000, new String[] { "You can deal knockback to other runners!" 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 818f153da..20851dcf5 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 @@ -16,7 +16,7 @@ public class KitWarper extends Kit { public KitWarper(ArcadeManager manager) { - super(manager, "Warper", KitAvailability.Blue, + super(manager, "Warper", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitPyrotechnic.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitPyrotechnic.java index e2efac54a..faf4d12e6 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitPyrotechnic.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/dragons/kits/KitPyrotechnic.java @@ -17,7 +17,7 @@ public class KitPyrotechnic extends Kit { public KitPyrotechnic(ArcadeManager manager) { - super(manager, "Pyrotechnic", KitAvailability.Blue, + super(manager, "Pyrotechnic", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java index 7cda7e553..86931296e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/Gravity.java @@ -104,8 +104,10 @@ public class Gravity extends SoloGame this.HungerSet = 10; this.WorldTimeSet = 18000; - + this.CompassEnabled = true; + + this.WorldBoundaryKill = false; } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityPlayer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityPlayer.java index 3fd907324..ec9b98915 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityPlayer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/gravity/objects/GravityPlayer.java @@ -104,6 +104,9 @@ public class GravityPlayer extends GravityObject public void KickOff(Player player) { + if (!Ent.equals(player)) + return; + GrabDelay = System.currentTimeMillis(); AddVelocity(player.getLocation().getDirection().multiply(0.5), 0.5); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java index aebd5dd80..29c83ef9b 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitHiderShocker.java @@ -22,7 +22,7 @@ public class KitHiderShocker extends Kit { public KitHiderShocker(ArcadeManager manager) { - super(manager, "Shocking Hider", KitAvailability.Blue, + super(manager, "Shocking Hider", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerRadar.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerRadar.java index 43598ac4f..c76b38437 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerRadar.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/hideseek/kits/KitSeekerRadar.java @@ -22,7 +22,7 @@ public class KitSeekerRadar extends Kit { public KitSeekerRadar(ArcadeManager manager) { - super(manager, "Radar Hunter", KitAvailability.Blue, + super(manager, "Radar Hunter", KitAvailability.Green, 5000, new String[] { "tick......tick...tick.tick.", 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 new file mode 100644 index 000000000..27e772f51 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/Micro.java @@ -0,0 +1,196 @@ +package nautilus.game.arcade.game.games.micro; + +import java.util.ArrayList; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.block.Block; +import org.bukkit.block.BlockFace; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.BlockBreakEvent; +import org.bukkit.event.block.BlockFromToEvent; +import org.bukkit.event.block.BlockPlaceEvent; + +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilMath; +import mineplex.core.common.util.UtilTime; +import mineplex.core.timing.TimingManager; +import mineplex.core.updater.UpdateType; +import mineplex.core.updater.event.UpdateEvent; +import mineplex.minecraft.game.core.damage.CustomDamageEvent; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.GameType; +import nautilus.game.arcade.game.TeamGame; +import nautilus.game.arcade.game.games.micro.kits.*; +import nautilus.game.arcade.kit.Kit; + +public class Micro extends TeamGame +{ + private ArrayList _blocks = new ArrayList(); + private ArrayList _glass = new ArrayList(); + + public Micro(ArcadeManager manager) + { + super(manager, GameType.Micro, + + new Kit[] + { + new KitArcher(manager), + new KitWorker(manager), + new KitFighter(manager) + }, + + new String[] + { + "Small game, big strategy!", + }); + + this.TeamArmor = true; + this.TeamArmorHotbar = true; + + this.InventoryClick = true; + + this.ItemDrop = true; + this.ItemPickup = true; + + this.BlockBreak = true; + this.BlockPlace = true; + } + + @Override + public void ParseData() + { + for (Location loc : WorldData.GetCustomLocs("20")) + _glass.add(loc.getBlock()); + + for (int y= WorldData.MinY ; y < WorldData.MaxY ; y++) + for (int x= WorldData.MinX ; x < WorldData.MaxX ; x++) + for (int z= WorldData.MinZ ; z < WorldData.MaxZ ; z++) + { + Block block = WorldData.World.getBlockAt(x, y, z); + + if (block.getType() == Material.AIR) + continue; + + _blocks.add(block); + } + } + + @EventHandler + public void BlockPlace(BlockPlaceEvent event) + { + if (event.isCancelled()) + return; + + _blocks.add(event.getBlock()); + } + + @EventHandler + public void BlockUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + if (_blocks.isEmpty()) + return; + + TimingManager.start("Block Fall"); + + for (int i = 0 ; i < 3 ; i++) + { + Block bestBlock = null; + double bestDist = 0; + + for (Block block : _blocks) + { + double dist = UtilMath.offset2d(GetSpectatorLocation(), block.getLocation().add(0.5, 0.5, 0.5)); + + if (bestBlock == null || dist > bestDist) + { + bestBlock = block; + bestDist = dist; + } + } + + //Shuffle Down + while (bestBlock.getRelative(BlockFace.DOWN).getType() != Material.AIR) + bestBlock = bestBlock.getRelative(BlockFace.DOWN); + + _blocks.remove(bestBlock); + + if (bestBlock.getType() != Material.AIR) + { + if (Math.random() > 0.75) + bestBlock.getWorld().spawnFallingBlock(bestBlock.getLocation().add(0.5, 0.5, 0.5), bestBlock.getType(), bestBlock.getData()); + + bestBlock.setType(Material.AIR); + } + } + + TimingManager.stop("Block Fall"); + } + + @EventHandler + public void TimeUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + if (!IsLive()) + return; + + WorldData.World.setTime(WorldData.World.getTime() + 1); + } + + @EventHandler + public void FoodUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.TICK) + return; + + for (Player player : GetPlayers(true)) + if (player.getFoodLevel() < 2) + player.setFoodLevel(2); + } + + @EventHandler + public void BarrierUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (!IsLive()) + return; + + if (_glass.isEmpty()) + return; + + if (!UtilTime.elapsed(GetStateTime(), 10000)) + return; + + for (Block block : _glass) + block.setType(Material.AIR); + + _glass.clear(); + } + + @EventHandler + public void BarrierBreak(BlockBreakEvent event) + { + if (_glass.contains(event.getBlock())) + event.setCancelled(true); + } + + @EventHandler + public void ArrowDecrease(CustomDamageEvent event) + { + if (event.GetProjectile() == null) + return; + + event.AddMod(GetName(), "Projectile Reduce", -2, false); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitArcher.java new file mode 100644 index 000000000..57adf0a73 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitArcher.java @@ -0,0 +1,42 @@ +package nautilus.game.arcade.game.games.micro.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +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.PerkFletcher; + +public class KitArcher extends Kit +{ + public KitArcher(ArcadeManager manager) + { + super(manager, "Archer", KitAvailability.Free, + + new String[] + { + "Shoot shoot!" + }, + + new Perk[] + { + new PerkFletcher(20, 3, true) + }, + EntityType.ZOMBIE, + new ItemStack(Material.BOW)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.BOW)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.APPLE, 3)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitFighter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitFighter.java new file mode 100644 index 000000000..e21fa53b5 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitFighter.java @@ -0,0 +1,41 @@ +package nautilus.game.arcade.game.games.micro.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +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.*; + +public class KitFighter extends Kit +{ + public KitFighter(ArcadeManager manager) + { + super(manager, "Fighter", KitAvailability.Free, + + new String[] + { + "HE LIKES TO FIGHT!" + }, + + new Perk[] + { + new PerkIronSkin(1) + }, + EntityType.ZOMBIE, + new ItemStack(Material.STONE_SWORD)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.APPLE, 5)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitWorker.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitWorker.java new file mode 100644 index 000000000..2b95ebfa4 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/micro/kits/KitWorker.java @@ -0,0 +1,42 @@ +package nautilus.game.arcade.game.games.micro.kits; + +import org.bukkit.Material; +import org.bukkit.entity.EntityType; +import org.bukkit.entity.Player; +import org.bukkit.inventory.ItemStack; + +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; + +public class KitWorker extends Kit +{ + public KitWorker(ArcadeManager manager) + { + super(manager, "Worker", KitAvailability.Free, + + new String[] + { + "DIG DIG!" + }, + + new Perk[] + { + + }, + EntityType.ZOMBIE, + new ItemStack(Material.STONE_PICKAXE)); + + } + + @Override + public void GiveItems(Player player) + { + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.WOOD_SWORD)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_SPADE)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.STONE_PICKAXE)); + player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.APPLE, 4)); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java index fc707f59c..67e00ff9e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/mineware/MineWare.java @@ -81,6 +81,12 @@ public class MineWare extends SoloGame this.BlockPlace = true; this.BlockBreak = true; + this.ItemDrop = true; + this.ItemPickup = true; + + this.InventoryOpen = true; + this.InventoryClick = true; + PopulateOrders(); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java index 62b5d3fb9..32f3de047 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/paintball/kits/KitMachineGun.java @@ -19,7 +19,7 @@ public class KitMachineGun extends Kit { public KitMachineGun(ArcadeManager manager) { - super(manager, "Machine Gun", KitAvailability.Blue, + super(manager, "Machine Gun", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitElementalist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitElementalist.java index 9de11409c..49c33bd33 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitElementalist.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/quiver/kits/KitElementalist.java @@ -20,7 +20,7 @@ public class KitElementalist extends Kit { public KitElementalist(ArcadeManager manager) { - super(manager, "Enchanter", KitAvailability.Blue, + super(manager, "Enchanter", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitFrosty.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitFrosty.java index aa6c65056..4ff4ce99d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitFrosty.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/runner/kits/KitFrosty.java @@ -19,7 +19,7 @@ public class KitFrosty extends Kit { public KitFrosty(ArcadeManager manager) { - super(manager, "Frosty", KitAvailability.Blue, + super(manager, "Frosty", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitBrute.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitBrute.java index 179742f58..df0dfc452 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitBrute.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sheep/kits/KitBrute.java @@ -19,7 +19,7 @@ public class KitBrute extends Kit { public KitBrute(ArcadeManager manager) { - super(manager, "Brute", KitAvailability.Blue, + super(manager, "Brute", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java index c9c451639..ce8c945a9 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitBlaze.java @@ -27,7 +27,7 @@ public class KitBlaze extends SmashKit { public KitBlaze(ArcadeManager manager) { - super(manager, "Blaze", KitAvailability.Blue, + super(manager, "Blaze", KitAvailability.Green, 6000, new String[] { @@ -106,10 +106,4 @@ public class KitBlaze extends SmashKit Manager.GetCondition().Factory().FireItemImmunity(GetName(), player, player, 1.9, false); } } - - @Override - public int GetCost() - { - return 6000; - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java index 1983b93d9..857c02d5e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitChicken.java @@ -23,7 +23,7 @@ public class KitChicken extends SmashKit { public KitChicken(ArcadeManager manager) { - super(manager, "Chicken", KitAvailability.Blue, + super(manager, "Chicken", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitComingSoon.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitComingSoon.java index 2d2fb25e3..22c070891 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitComingSoon.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitComingSoon.java @@ -15,7 +15,7 @@ public class KitComingSoon extends SmashKit { public KitComingSoon(ArcadeManager manager) { - super(manager, C.cRed + "Coming Soon", KitAvailability.Blue, + super(manager, C.cRed + "Coming Soon", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java index 386f3eb6c..f5be517e4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCow.java @@ -19,7 +19,7 @@ public class KitCow extends SmashKit { public KitCow(ArcadeManager manager) { - super(manager, "Mad Cow", KitAvailability.Blue, + super(manager, "Mad Cow", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java index cfc24b249..408d57148 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitCreeper.java @@ -24,7 +24,7 @@ public class KitCreeper extends SmashKit { public KitCreeper(ArcadeManager manager) { - super(manager, "Creeper", KitAvailability.Green, + super(manager, "Creeper", KitAvailability.Green, 4000, new String[] { @@ -95,10 +95,4 @@ public class KitCreeper extends SmashKit disguise.SetCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } - - @Override - public int GetCost() - { - return 4000; - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java index 1f28a88fc..e0c922169 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitEnderman.java @@ -34,7 +34,7 @@ public class KitEnderman extends SmashKit public KitEnderman(ArcadeManager manager) { - super(manager, "Enderman", KitAvailability.Green, + super(manager, "Enderman", KitAvailability.Green, 4000, new String[] { @@ -147,10 +147,4 @@ public class KitEnderman extends SmashKit } } } - - @Override - public int GetCost() - { - return 4000; - } } 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 e27a72c01..b33110b46 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 @@ -50,7 +50,7 @@ public class KitKnight extends SmashKit public KitKnight(ArcadeManager manager) { - super(manager, "Undead Knight", KitAvailability.Blue, + super(manager, "Undead Knight", KitAvailability.Green, 5000, new String[] { @@ -254,7 +254,7 @@ public class KitKnight extends SmashKit LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type); entity.setRemoveWhenFarAway(false); - entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit" + (GetAvailability() == KitAvailability.Blue ? ChatColor.GRAY + " (" + ChatColor.WHITE + "Ultra" + ChatColor.GRAY + ")" : "")); + entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit"); entity.setCustomNameVisible(true); entity.getEquipment().setItemInHand(_itemInHand); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java index 6cb7ba3aa..e935bb2cf 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitMagmaCube.java @@ -19,7 +19,7 @@ public class KitMagmaCube extends SmashKit { public KitMagmaCube(ArcadeManager manager) { - super(manager, "Magma Cube", KitAvailability.Blue, + super(manager, "Magma Cube", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java index a2a83d46f..7ad27329c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitPig.java @@ -23,7 +23,7 @@ public class KitPig extends SmashKit { public KitPig(ArcadeManager manager) { - super(manager, "Pig", KitAvailability.Blue, + super(manager, "Pig", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java index 58e38686d..cbdad7e94 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkeletalHorse.java @@ -27,7 +27,7 @@ public class KitSkeletalHorse extends SmashKit { public KitSkeletalHorse(ArcadeManager manager) { - super(manager, "Skeletal Horse", KitAvailability.Blue, + super(manager, "Skeletal Horse", KitAvailability.Green, 5000, new String[] { @@ -111,7 +111,7 @@ public class KitSkeletalHorse extends SmashKit LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type); entity.setRemoveWhenFarAway(false); - entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit" + (GetAvailability() == KitAvailability.Blue ? ChatColor.GRAY + " (" + ChatColor.WHITE + "Ultra" + ChatColor.GRAY + ")" : "")); + entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit"); entity.setCustomNameVisible(true); entity.getEquipment().setItemInHand(_itemInHand); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java index 034e085f1..b9d9f5cba 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSkySquid.java @@ -22,7 +22,7 @@ public class KitSkySquid extends SmashKit { public KitSkySquid(ArcadeManager manager) { - super(manager, "Sky Squid", KitAvailability.Blue, + super(manager, "Sky Squid", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java index 28a626dd0..d9a16b11a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSnowman.java @@ -25,7 +25,7 @@ public class KitSnowman extends SmashKit { public KitSnowman(ArcadeManager manager) { - super(manager, "Snowman", KitAvailability.Green, + super(manager, "Snowman", KitAvailability.Green, 5000, new String[] { @@ -94,10 +94,4 @@ public class KitSnowman extends SmashKit disguise.SetCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } - - @Override - public int GetCost() - { - return 5000; - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java index c1115005f..81b49e863 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitSpider.java @@ -101,10 +101,4 @@ public class KitSpider extends SmashKit disguise.SetCustomNameVisible(true); Manager.GetDisguise().disguise(disguise); } - - @Override - public int GetCost() - { - return 2000; - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java index f14c5b0a0..3526305d7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitch.java @@ -26,7 +26,7 @@ public class KitWitch extends SmashKit { public KitWitch(ArcadeManager manager) { - super(manager, "Witch", KitAvailability.Blue, + super(manager, "Witch", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWither.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWither.java index 758cd9260..f31f7bb18 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWither.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWither.java @@ -29,7 +29,7 @@ public class KitWither extends SmashKit { public KitWither(ArcadeManager manager) { - super(manager, "Wither", KitAvailability.Blue, + super(manager, "Wither", KitAvailability.Green, 5000, new String[] { @@ -101,7 +101,7 @@ public class KitWither extends SmashKit LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type); entity.setRemoveWhenFarAway(false); - entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit" + (GetAvailability() == KitAvailability.Blue ? ChatColor.GRAY + " (" + ChatColor.WHITE + "Ultra" + ChatColor.GRAY + ")" : "")); + entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit"); entity.setCustomNameVisible(true); entity.getEquipment().setItemInHand(_itemInHand); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java index d4ff7f82d..33fdd7bc4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/smash/kits/KitWitherSkeleton.java @@ -24,7 +24,7 @@ public class KitWitherSkeleton extends SmashKit { public KitWitherSkeleton(ArcadeManager manager) { - super(manager, "Wither Skeleton", KitAvailability.Blue, + super(manager, "Wither Skeleton", KitAvailability.Green, 6000, new String[] { @@ -83,10 +83,4 @@ public class KitWitherSkeleton extends SmashKit disguise.hideArmor(); Manager.GetDisguise().disguise(disguise); } - - @Override - public int GetCost() - { - return 6000; - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitInvulnerable.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitInvulnerable.java index 241b76a9c..55c1d6748 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitInvulnerable.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitInvulnerable.java @@ -17,7 +17,7 @@ public class KitInvulnerable extends Kit { public KitInvulnerable(ArcadeManager manager) { - super(manager, "Super Snake", KitAvailability.Blue, + super(manager, "Super Snake", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitOther.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitOther.java index aab268773..d620e9a8d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitOther.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/snake/kits/KitOther.java @@ -17,7 +17,7 @@ public class KitOther extends Kit { public KitOther(ArcadeManager manager) { - super(manager, "Other Snake", KitAvailability.Blue, + super(manager, "Other Snake", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java index c68f5fa41..e5b95272d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/SneakyAssassins.java @@ -1,8 +1,10 @@ package nautilus.game.arcade.game.games.sneakyassassins; import mineplex.core.common.util.*; +import mineplex.core.disguise.*; import mineplex.core.updater.*; import mineplex.core.updater.event.*; +import mineplex.minecraft.game.core.combat.event.*; import mineplex.minecraft.game.core.damage.*; import nautilus.game.arcade.*; import nautilus.game.arcade.events.*; @@ -14,7 +16,10 @@ import nautilus.game.arcade.kit.*; import org.bukkit.*; import org.bukkit.entity.*; import org.bukkit.event.*; +import org.bukkit.event.entity.*; +import org.bukkit.event.hanging.*; import org.bukkit.event.player.*; +import org.bukkit.potion.*; import java.util.*; @@ -33,6 +38,8 @@ public class SneakyAssassins extends SoloGame private final NpcManager _npcManager; private PowerUpManager _powerUpManager; + private EntityType _disguiseType = EntityType.VILLAGER; + private int _revealCountdown = 60; public SneakyAssassins(ArcadeManager manager) { @@ -40,20 +47,29 @@ public class SneakyAssassins extends SoloGame manager, GameType.SneakyAssassins, new Kit[]{ - new KitEscapeArtist(manager), - new KitAssassin(manager), - new KitRevealer(manager) + new KitEscapeArtist(manager, EntityType.VILLAGER), + new KitAssassin(manager, EntityType.VILLAGER), + new KitRevealer(manager, EntityType.VILLAGER) }, - new String[]{ - "Sneaky Assassins" + new String[] + { + "Each kill grants you +1 Heart", + "Powerups upgrade Armor/Weapon", + "Get 5 Powerups to become a Master!", + "Master has a Compass to find others", + "Last player alive wins!" } ); this._npcManager = new NpcManager(this, UtilMath.random); this.DamageTeamSelf = true; - this.HungerSet = 20; this.PrepareFreeze = false; + + this.HungerSet = 20; + + this.CompassEnabled = true; + this.CompassGiveItem = false; } @Override @@ -62,6 +78,15 @@ public class SneakyAssassins extends SoloGame Collections.shuffle(GetTeamList().get(0).GetSpawns()); _powerUpManager = new PowerUpManager(this, UtilMath.random, WorldData.GetDataLocs("RED")); + + String disguiseTypeName = WorldData.get("DISGUISE_TYPE"); + if (disguiseTypeName != null) + _disguiseType = EntityType.valueOf(disguiseTypeName.toUpperCase()); + + _npcManager.setDisguiseType(_disguiseType); + + for (Kit kit : GetKits()) + kit.setEntityType(_disguiseType); } public PowerUpManager getPowerUpManager() @@ -74,11 +99,9 @@ public class SneakyAssassins extends SoloGame { if (event.GetGame() == this) { - int count = GetTeamList().get(0).GetSpawns().size() - GetTeamList().get(0).GetSize(); - - for (int i = 0; i < 80; i++) + for (int i = 0; i < 200; i++) getNpcManager().spawnNpc(); - } + } } /* @@ -126,13 +149,165 @@ public class SneakyAssassins extends SoloGame event.AddMod(GetName(), "Sword Damage", damage - event.GetDamage(), false); } + @EventHandler + public void onCombatDeath(CombatDeathEvent event) + { + if (event.GetLog().GetKiller() == null) + return; + + if (!event.GetLog().GetKiller().IsPlayer()) + return; + + Player player = UtilPlayer.searchExact(event.GetLog().GetKiller().GetName()); + if (player == null) + return; + + player.setMaxHealth(player.getMaxHealth() + 2); + + player.getInventory().addItem(SneakyAssassinKit.SMOKE_BOMB.clone()); + } + + @Override + @EventHandler + public void ScoreboardUpdate(UpdateEvent event) + { + if (event.getType() != UpdateType.FAST) + return; + + if (GetTeamList().isEmpty()) + return; + + Scoreboard.Reset(); + + Scoreboard.WriteBlank(); + + GameTeam team = GetTeamList().get(0); + + if (team.GetPlayers(false).size() < 13) + { + for (Player player : team.GetPlayers(false)) + { + if (team.IsAlive(player)) + { + Scoreboard.WriteOrdered("Powerups", C.cGreen + player.getName(), getPowerUpManager().getPowerUpCount(player), true); + } + else + { + Scoreboard.WriteOrdered("Powerups", C.cGray + player.getName(), getPowerUpManager().getPowerUpCount(player), true); + } + } + } + else if (team.GetPlayers(true).size() < 13) + { + for (Player player : team.GetPlayers(true)) + { + Scoreboard.WriteOrdered("Powerups", C.cGreen + player.getName(), getPowerUpManager().getPowerUpCount(player), true); + } + } + else + { + Scoreboard.Write(C.cGreen + "Players Alive"); + Scoreboard.Write("" + team.GetPlayers(true).size()); + + Scoreboard.WriteBlank(); + Scoreboard.Write(C.cRed + "Players Dead"); + Scoreboard.Write("" + (team.GetPlayers(false).size() - team.GetPlayers(true).size())); + } + + GetScoreboard().WriteBlank(); + GetScoreboard().Write(C.cYellow + "Player Reveal"); + GetScoreboard().Write(String.valueOf(Math.max(0, _revealCountdown)) + (_revealCountdown == 1 ? " Second" : " Seconds")); + GetScoreboard().Draw(); + } + + @EventHandler + public void onRevealCountdown(UpdateEvent event) + { + if (GetState() == GameState.Live && event.getType() == UpdateType.SEC) + { + _revealCountdown--; + + if (_revealCountdown <= 3 && _revealCountdown > 0) + { + this.Announce(F.main("Game", C.cYellow + C.Bold + "Players Revealed in " + _revealCountdown + " Seconds")); + } + else if (_revealCountdown == 0) + { + for (Player player : Bukkit.getOnlinePlayers()) + { + if (IsAlive(player)) + { + Manager.GetDisguise().undisguise(player); + player.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 80, 0)); + } + } + + this.Announce(F.main("Game", C.cRed + C.Bold + "Players Revealed!")); + } + else if (_revealCountdown == -4) + { + for (Player player : Bukkit.getOnlinePlayers()) + { + if (IsAlive(player)) + { + Manager.GetDisguise().disguise(DisguiseFactory.createDisguise(player, _disguiseType)); + player.removePotionEffect(PotionEffectType.WITHER); + } + } + + _revealCountdown = 60; + + this.Announce(F.main("Game", C.cGreen + C.Bold + "Players Disguised!")); + } + } + } + @EventHandler(ignoreCancelled = true) public void onPlayerInteractEntity(PlayerInteractEntityEvent event) { - if(event.getRightClicked() instanceof Villager) + if (event.getRightClicked() instanceof Villager) event.setCancelled(true); } + @EventHandler(ignoreCancelled = true) + public void onEntityCombust(EntityCombustEvent event) + { + event.setCancelled(true); + } + + @EventHandler(ignoreCancelled = true) + public void onHangingBreak(HangingBreakEvent event) + { + event.setCancelled(true); + } + + @EventHandler(ignoreCancelled = true) + public void onHangingPlace(HangingPlaceEvent event) + { + event.setCancelled(true); + } + + @EventHandler(ignoreCancelled = true) + public void onPlayerInteractHanging(PlayerInteractEntityEvent event) + { + if (event.getRightClicked() instanceof Hanging) + event.setCancelled(true); + } + + @EventHandler(ignoreCancelled = true) + public void onDamageHanging(EntityDamageEvent event) + { + if (event.getEntity() instanceof Hanging) + event.setCancelled(true); + } + + @EventHandler(ignoreCancelled = true) + public void onWitherEffectDamager(CustomDamageEvent event) + { + if (event.GetCause() == EntityDamageEvent.DamageCause.WITHER) + event.SetCancelled("Wither damage disabled"); + } + public NpcManager getNpcManager() { return _npcManager; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitAssassin.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitAssassin.java index 985ab658a..bb411c70a 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitAssassin.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitAssassin.java @@ -10,7 +10,7 @@ import org.bukkit.inventory.*; public class KitAssassin extends SneakyAssassinKit { - public KitAssassin(ArcadeManager manager) + public KitAssassin(ArcadeManager manager, EntityType disguiseType) { super(manager, "Ranged Assassin", KitAvailability.Green, new String[] @@ -19,9 +19,10 @@ public class KitAssassin extends SneakyAssassinKit }, new Perk[] { - new PerkSmokebomb(Material.INK_SACK, 5, true) + new PerkSmokebomb(Material.INK_SACK, 4, true) }, - new ItemStack(Material.BOW)); + new ItemStack(Material.BOW), + disguiseType); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitEscapeArtist.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitEscapeArtist.java index c77559d97..b459ae920 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitEscapeArtist.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitEscapeArtist.java @@ -9,7 +9,7 @@ import org.bukkit.inventory.*; public class KitEscapeArtist extends SneakyAssassinKit { - public KitEscapeArtist(ArcadeManager manager) + public KitEscapeArtist(ArcadeManager manager, EntityType disguiseType) { super(manager, "Escape Artist", KitAvailability.Free, new String[] @@ -18,9 +18,10 @@ public class KitEscapeArtist extends SneakyAssassinKit }, new Perk[] { - new PerkSmokebomb(Material.INK_SACK, 5, true) + new PerkSmokebomb(Material.INK_SACK, 4, true) }, - new ItemStack(Material.INK_SACK)); + new ItemStack(Material.INK_SACK), + disguiseType); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitRevealer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitRevealer.java index df7a18b94..2a9bb5138 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitRevealer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/KitRevealer.java @@ -12,19 +12,20 @@ import org.bukkit.inventory.*; public class KitRevealer extends SneakyAssassinKit { - public KitRevealer(ArcadeManager manager) + public KitRevealer(ArcadeManager manager, EntityType disguiseType) { - super(manager, "Revealer", KitAvailability.Blue, + super(manager, "Revealer", KitAvailability.Green, 5000, new String[] { "Carries three Revealers which explode and reveal nearby assassins!" }, new Perk[] { - new PerkSmokebomb(Material.INK_SACK, 5, true), + new PerkSmokebomb(Material.INK_SACK, 4, true), new PerkRevealer() }, - new ItemStack(Material.INK_SACK)); + new ItemStack(Material.INK_SACK), + disguiseType); } @Override diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/SneakyAssassinKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/SneakyAssassinKit.java index 6e3edb4fe..0019ec3d0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/SneakyAssassinKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/kits/SneakyAssassinKit.java @@ -1,6 +1,7 @@ package nautilus.game.arcade.game.games.sneakyassassins.kits; import mineplex.core.common.util.*; +import mineplex.core.disguise.*; import mineplex.core.disguise.disguises.*; import mineplex.core.itemstack.*; import nautilus.game.arcade.*; @@ -11,16 +12,31 @@ import org.bukkit.inventory.*; public abstract class SneakyAssassinKit extends Kit { - public SneakyAssassinKit(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, ItemStack itemInHand) + public static final ItemStack SMOKE_BOMB = ItemStackFactory.Instance.CreateStack(Material.INK_SACK, (byte) 0, 1, + C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Smoke Bomb", + new String[] + { + ChatColor.RESET + "Throw a Smoke Bomb.", + ChatColor.RESET + "Everyone within 6 blocks", + ChatColor.RESET + "gets Blindness for 6 seconds.", + + }); + + public SneakyAssassinKit(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, ItemStack itemInHand, EntityType disguiseType) { - super(manager, name, kitAvailability, kitDesc, kitPerks, EntityType.VILLAGER, itemInHand); + super(manager, name, kitAvailability, kitDesc, kitPerks, disguiseType, itemInHand); + } + + public SneakyAssassinKit(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, ItemStack itemInHand, EntityType disguiseType) + { + super(manager, name, kitAvailability, cost, kitDesc, kitPerks, disguiseType, itemInHand); } @Override public void GiveItems(Player player) { - Manager.GetDisguise().disguise(new DisguiseVillager(player)); - + Manager.GetDisguise().disguise(DisguiseFactory.createDisguise(player, _entityType)); + player.getInventory().addItem(new ItemStack(Material.WOOD_SWORD)); player.getInventory().setArmorContents(new ItemStack[]{ new ItemStack(Material.LEATHER_BOOTS), @@ -28,14 +44,6 @@ public abstract class SneakyAssassinKit extends Kit new ItemStack(Material.LEATHER_CHESTPLATE), new ItemStack(Material.LEATHER_HELMET) }); - player.getInventory().addItem(ItemStackFactory.Instance.CreateStack(Material.INK_SACK, (byte) 0, 1, - C.cYellow + C.Bold + "Right-Click" + C.cWhite + C.Bold + " - " + C.cGreen + C.Bold + "Smoke Bomb", - new String[] - { - ChatColor.RESET + "Throw a Smoke Bomb.", - ChatColor.RESET + "Everyone within 6 blocks", - ChatColor.RESET + "gets Blindness for 6 seconds.", - - })); + player.getInventory().addItem(SMOKE_BOMB.clone()); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java index 3b152cd1e..c3889854f 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/npc/NpcManager.java @@ -8,6 +8,7 @@ import nautilus.game.arcade.game.*; import nautilus.game.arcade.game.games.sneakyassassins.*; import nautilus.game.arcade.world.*; import org.bukkit.*; +import org.bukkit.block.*; import org.bukkit.entity.*; import org.bukkit.event.*; import org.bukkit.event.entity.*; @@ -19,6 +20,7 @@ public class NpcManager implements Listener { private final SneakyAssassins _sneakyAssassins; private final Random _random; + private EntityType _disguiseType = EntityType.VILLAGER; public NpcManager(SneakyAssassins sneakyAssassins, Random random) { @@ -33,17 +35,17 @@ public class NpcManager implements Listener return _sneakyAssassins; } - public Collection getNpcs() + public Collection getNpcs() { - return getGame().WorldData.World.getEntitiesByClass(Villager.class); + return (Collection) getGame().WorldData.World.getEntitiesByClass(getDisguiseType().getEntityClass()); } - public Villager spawnNpc() + public Entity spawnNpc() { Location spawn = getNpcSpawn(); getGame().CreatureAllowOverride = true; - Villager npc = spawn.getWorld().spawn(spawn, Villager.class); + LivingEntity npc = (LivingEntity) spawn.getWorld().spawn(spawn, getDisguiseType().getEntityClass()); npc.setCanPickupItems(false); npc.setRemoveWhenFarAway(false); UtilEnt.Vegetate(npc); @@ -68,33 +70,67 @@ public class NpcManager implements Listener } @EventHandler - public void onEntityDeath(EntityDeathEvent event) + public void onKillNpc(UpdateEvent event) { - try + if (event.getType() == UpdateType.SLOW && getGame().GetState() == Game.GameState.Live) { - if (event.getEntity().getWorld() == getGame().WorldData.World) + List npcs = new ArrayList<>(getNpcs()); + + if (!npcs.isEmpty()) { - event.setDroppedExp(0); - event.getDrops().clear(); + LivingEntity npc = UtilAlg.Random(npcs); + + UtilParticle.PlayParticle(UtilParticle.ParticleType.LARGE_SMOKE, npc.getLocation(), 0f, 0f, 0f, 0, 1); + npc.remove(); } } - catch (Exception e) - { - e.printStackTrace(); - } + } + + @EventHandler + public void onEntityDeath(EntityDeathEvent event) + { + event.setDroppedExp(0); + event.getDrops().clear(); } public void bustle() { - for (Villager npc : getNpcs()) + for (Entity npc : getNpcs()) { if (getRandom().nextInt(40) == 0) { - Location loc = npc.getLocation().add(getRandom().nextDouble() * 32 - 16, 0, getRandom().nextDouble() * 32 - 16); + List nearby = new ArrayList<>(); - if (loc.getWorld().getHighestBlockYAt(loc) > 0) + for (Location location : getGame().GetTeamList().get(0).GetSpawns()) { - UtilEnt.CreatureMove(npc, loc, 0.8f); + if (Math.abs(npc.getLocation().getX() - location.getX()) <= 16 && Math.abs(npc.getLocation().getZ() - location.getZ()) <= 16) + nearby.add(location); + } + + if (!nearby.isEmpty()) + { + Location location = UtilAlg.Random(nearby); + + for (int i = 0; i < 5; i++) + { + int dx = getRandom().nextInt(5) - 2; + int dz = getRandom().nextInt(5) - 2; + + Location candidate = location.clone().add(dx, 0, dz); + Block block = candidate.getBlock(); + + if (!block.getRelative(BlockFace.DOWN).isEmpty() && + !block.getRelative(BlockFace.DOWN).isLiquid() && + block.isEmpty() && + block.getRelative(BlockFace.UP).isEmpty()) + { + location = candidate; + + break; + } + } + + UtilEnt.CreatureMove(npc, location, 0.7f); } } } @@ -109,4 +145,14 @@ public class NpcManager implements Listener { return getGame().Manager.GetPlugin(); } + + public EntityType getDisguiseType() + { + return _disguiseType; + } + + public void setDisguiseType(EntityType disguiseType) + { + _disguiseType = disguiseType; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/ArmorPowerUp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/ArmorPowerUp.java index 21809071c..23d18386e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/ArmorPowerUp.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/ArmorPowerUp.java @@ -32,32 +32,21 @@ public class ArmorPowerUp extends PowerUp ) ); - public ArmorPowerUp(PowerUpManager powerUpManager, Location location) + public ArmorPowerUp() { - super(powerUpManager, PowerUpType.ARMOR, location); + super(PowerUpType.ARMOR); } @Override - public boolean powerUpPlayer(Player player) + public boolean powerUpPlayer(Player player, Random random) { - boolean powerUp1 = powerUpArmor(player); - boolean powerUp2 = powerUpArmor(player); + boolean powerUp1 = powerUpArmor(player, random); + boolean powerUp2 = powerUpArmor(player, random); - if (powerUp1 || powerUp2) - { - UtilPlayer.message(player, F.main("Power-Up", "Your " + F.item("Armor") + " was upgraded.")); - - return super.powerUpPlayer(player); - } - else - { - UtilPlayer.message(player, F.main("Power-Up", "Your " + F.item("Armor") + " is already fully upgraded!")); - - return false; - } + return powerUp1 || powerUp2; } - private boolean powerUpArmor(Player player) + public static boolean powerUpArmor(Player player, Random random) { ItemStack[] armor = player.getInventory().getArmorContents(); @@ -73,7 +62,7 @@ public class ArmorPowerUp extends PowerUp if (!upgradeable.isEmpty()) { - int choice = upgradeable.get(getPowerUpManager().getRandom().nextInt(upgradeable.size())); + int choice = upgradeable.get(random.nextInt(upgradeable.size())); int nextLevel = Math.min(ARMOR_PROGRESSION.get(choice).size() - 1, level + 1); armor[choice] = new ItemStack(ARMOR_PROGRESSION.get(choice).get(nextLevel)); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/CompassPowerUp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/CompassPowerUp.java new file mode 100644 index 000000000..34b5c9095 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/CompassPowerUp.java @@ -0,0 +1,26 @@ +package nautilus.game.arcade.game.games.sneakyassassins.powerups; + +import org.bukkit.*; +import org.bukkit.entity.*; +import org.bukkit.inventory.*; + +import java.util.*; + +public class CompassPowerUp extends PowerUp +{ + protected CompassPowerUp() + { + super(PowerUpType.COMPASS); + } + + @Override + public boolean powerUpPlayer(Player player, Random random) + { + if (player.getInventory().contains(Material.COMPASS)) + return false; + + player.getInventory().addItem(new ItemStack(Material.COMPASS)); + + return true; + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUp.java index 4dc0ed861..45f792169 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUp.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUp.java @@ -1,111 +1,18 @@ package nautilus.game.arcade.game.games.sneakyassassins.powerups; -import mineplex.core.common.util.*; -import mineplex.core.updater.*; -import mineplex.core.updater.event.*; +import java.util.Random; + +import nautilus.game.arcade.game.games.sneakyassassins.kits.*; import org.bukkit.*; -import org.bukkit.block.*; import org.bukkit.entity.*; -import org.bukkit.inventory.*; -import org.bukkit.material.*; -import org.bukkit.util.*; public abstract class PowerUp { - private final PowerUpManager _powerUpManager; private final PowerUpType _powerUpType; - private final Location _location; - private Location _effectLocation; - private Block _beaconBlock; - private BlockState[][][] _originalBeaconBlocks = new BlockState[3][2][3]; - private Item _item; - public PowerUp(PowerUpManager powerUpManager, PowerUpType powerUpType, Location location) + protected PowerUp(PowerUpType powerUpType) { - _powerUpManager = powerUpManager; _powerUpType = powerUpType; - _location = location; - _effectLocation = getLocation().getBlock().getLocation().add(0.5, 0, 0.5); - _effectLocation.setY(250); - } - - public PowerUpManager getPowerUpManager() - { - return _powerUpManager; - } - - public Location getLocation() - { - return _location; - } - - @SuppressWarnings("deprecation") - public void activate() - { - _beaconBlock = getLocation().getBlock().getRelative(BlockFace.DOWN); - - for (int x = 0; x < 3; x++) - { - for (int y = 0; y < 2; y++) - { - for (int z = 0; z < 3; z++) - { - Block beaconBaseBlock = _beaconBlock.getRelative(x - 1, y - 1, z - 1); - - _originalBeaconBlocks[x][y][z] = beaconBaseBlock.getState(); - - if (y == 0) - beaconBaseBlock.setType(Material.IRON_BLOCK); - else if (x == 1 && z == 1) - beaconBaseBlock.setType(Material.BEACON); - else - beaconBaseBlock.setTypeIdAndData(Material.STAINED_GLASS.getId(), getPowerUpType().getDyeColor().getWoolData(), false); - } - } - } - } - - public void onUpdate(UpdateEvent event) - { - if (event.getType() == UpdateType.FASTEST && _effectLocation != null) - { - FireworkEffect effect = FireworkEffect - .builder() - .flicker(false) - .withColor(getPowerUpType().getColor()) - .with(FireworkEffect.Type.BURST) - .trail(false) - .build(); - - UtilFirework.playFirework(_effectLocation, effect); - - _effectLocation.setY(_effectLocation.getY() - 2); - - if (_effectLocation.getY() - getLocation().getY() < 2) - { - _effectLocation = null; - - Location itemLocation = _beaconBlock.getLocation().add(0.5, 1.5, 0.5); - - effect = FireworkEffect - .builder() - .flicker(false) - .withColor(getPowerUpType().getColor()) - .with(FireworkEffect.Type.BALL_LARGE) - .trail(true) - .build(); - - UtilFirework.playFirework(itemLocation, effect); - - _item = itemLocation.getWorld().dropItem(itemLocation, new ItemStack(getPowerUpType().getItemType())); - _item.setVelocity(new Vector(0, 0.15, 0)); - } - } - } - - public Item getItem() - { - return _item; } public PowerUpType getPowerUpType() @@ -113,26 +20,5 @@ public abstract class PowerUp return _powerUpType; } - public void remove() - { - if (getItem() != null) - { - getItem().remove(); - _item = null; - } - - for (int x = 0; x < _originalBeaconBlocks.length; x++) - for (int y = 0; y < _originalBeaconBlocks[x].length; y++) - for (int z = 0; z < _originalBeaconBlocks[x][y].length; z++) - _originalBeaconBlocks[x][y][z].update(true, false); - - getPowerUpManager().removePowerUp(this); - } - - public boolean powerUpPlayer(Player player) - { - player.playSound(player.getEyeLocation(), Sound.LEVEL_UP, 2f, 0.8f); - - return true; - } + public abstract boolean powerUpPlayer(Player player, Random random); } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java new file mode 100644 index 000000000..f88bfb88d --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpItem.java @@ -0,0 +1,126 @@ +package nautilus.game.arcade.game.games.sneakyassassins.powerups; + +import mineplex.core.common.util.*; +import mineplex.core.updater.*; +import mineplex.core.updater.event.*; +import org.bukkit.*; +import org.bukkit.block.*; +import org.bukkit.entity.*; +import org.bukkit.inventory.*; +import org.bukkit.util.*; + +/** + * Created by Tim on 8/5/2014. + */ +public class PowerUpItem +{ + private final PowerUpManager _powerUpManager; + private final Location _location; + private Location _effectLocation; + private Block _beaconBlock; + private BlockState[][][] _originalBeaconBlocks = new BlockState[3][2][3]; + private Item _item; + + public PowerUpItem(PowerUpManager powerUpManager, Location location) + { + _powerUpManager = powerUpManager; + _location = location; + _effectLocation = getLocation().getBlock().getLocation().add(0.5, 0, 0.5); + _effectLocation.setY(250); + } + + public PowerUpManager getPowerUpManager() + { + return _powerUpManager; + } + + public Location getLocation() + { + return _location; + } + + @SuppressWarnings("deprecation") + public void activate() + { + _beaconBlock = getLocation().getBlock().getRelative(BlockFace.DOWN); + + for (int x = 0; x < 3; x++) + { + for (int y = 0; y < 2; y++) + { + for (int z = 0; z < 3; z++) + { + Block beaconBaseBlock = _beaconBlock.getRelative(x - 1, y - 1, z - 1); + + _originalBeaconBlocks[x][y][z] = beaconBaseBlock.getState(); + + if (y == 0) + beaconBaseBlock.setType(Material.IRON_BLOCK); + else if (x == 1 && z == 1) + beaconBaseBlock.setType(Material.BEACON); + else + beaconBaseBlock.setTypeIdAndData(Material.STAINED_GLASS.getId(), DyeColor.YELLOW.getWoolData(), false); + } + } + } + } + + public void onUpdate(UpdateEvent event) + { + if (event.getType() == UpdateType.FASTEST && _effectLocation != null) + { + FireworkEffect effect = FireworkEffect + .builder() + .flicker(false) + .withColor(Color.YELLOW) + .with(FireworkEffect.Type.BURST) + .trail(false) + .build(); + + UtilFirework.playFirework(_effectLocation, effect); + + _effectLocation.setY(_effectLocation.getY() - 2); + + if (_effectLocation.getY() - getLocation().getY() < 2) + { + _effectLocation = null; + + Location itemLocation = _beaconBlock.getLocation().add(0.5, 1.5, 0.5); + + effect = FireworkEffect + .builder() + .flicker(false) + .withColor(Color.YELLOW) + .with(FireworkEffect.Type.BALL_LARGE) + .trail(true) + .build(); + + UtilFirework.playFirework(itemLocation, effect); + + _item = itemLocation.getWorld().dropItem(itemLocation, new ItemStack(Material.CHEST)); + _item.setVelocity(new Vector(0, 0.15, 0)); + } + } + } + + public Item getItem() + { + return _item; + } + + public void remove() + { + if (getItem() != null) + { + getItem().remove(); + _item = null; + } + + for (int x = 0; x < _originalBeaconBlocks.length; x++) + for (int y = 0; y < _originalBeaconBlocks[x].length; y++) + for (int z = 0; z < _originalBeaconBlocks[x][y].length; z++) + _originalBeaconBlocks[x][y][z].update(true, false); + + getPowerUpManager().removePowerUp(this); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpManager.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpManager.java index 35f9b0664..af4fd9b45 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpManager.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpManager.java @@ -1,5 +1,6 @@ package nautilus.game.arcade.game.games.sneakyassassins.powerups; +import mineplex.core.common.util.*; import mineplex.core.updater.*; import mineplex.core.updater.event.*; import nautilus.game.arcade.events.*; @@ -19,10 +20,10 @@ public class PowerUpManager implements Listener private final Game _game; private final Random _random; private final List _spawnLocations; - private final List _powerUps = new ArrayList<>(); + private final List _powerUps = new ArrayList<>(); private Location _lastLocation = null; private int _nextSpawnCountdown = -1; - private final Map _powerUpPickUpCooldown = new HashMap<>(); + private final Map _powerUpCount = new HashMap<>(); public PowerUpManager(Game game, Random random, List spawnLocations) { @@ -70,18 +71,20 @@ public class PowerUpManager implements Listener public void spawnNextPowerUp() { - PowerUp powerUp = PowerUpType.values()[getRandom().nextInt(PowerUpType.values().length)].spawn(this, nextLocation()); + PowerUpItem powerUp = new PowerUpItem(this, nextLocation()); getPowerUps().add(powerUp); powerUp.activate(); + + getGame().Announce(F.main("Game", C.cYellow + C.Bold + "Powerup Spawning...")); } - public List getPowerUps() + public List getPowerUps() { return _powerUps; } - boolean removePowerUp(PowerUp powerUp) + boolean removePowerUp(PowerUpItem powerUp) { return _powerUps.remove(powerUp); } @@ -125,7 +128,7 @@ public class PowerUpManager implements Listener _nextSpawnCountdown--; } - for (PowerUp powerUp : getPowerUps()) + for (PowerUpItem powerUp : getPowerUps()) powerUp.onUpdate(event); } @@ -147,49 +150,103 @@ public class PowerUpManager implements Listener } @EventHandler - public void onPlayerPickUpPowerUp(final PlayerPickupItemEvent event) + public void onPlayerPickUpPowerUp(PlayerPickupItemEvent event) { - if (getGame().GetTeam(event.getPlayer()) != null) + if (!getGame().IsAlive(event.getPlayer())) + return; + + PowerUpItem powerUp = getPowerUpByItem(event.getItem()); + if (powerUp == null) + return; + + event.setCancelled(true); + + int count = getPowerUpCount(event.getPlayer()); + + if (count <= 4) { - final PowerUp powerUp = getPowerUpByItem(event.getItem()); + powerUp.remove(); - if (powerUp != null) + if (PowerUpType.SMOKE_BOMB.powerUpPlayer(event.getPlayer(), getRandom())) + UtilPlayer.message(event.getPlayer(), F.main("Power-Up", "+1 " + F.item("Smoke Bomb"))); + + if (count == 4) { - event.setCancelled(true); + PowerUpType.COMPASS.powerUpPlayer(event.getPlayer(), getRandom()); - if (_powerUpPickUpCooldown.get(event.getPlayer().getUniqueId()) != powerUp) + UtilPlayer.message(event.getPlayer(), F.main("Game", "You now have a " + F.item("Compass") + " for tracking players")); + + getGame().Announce(F.main("Game", F.name(C.Bold + event.getPlayer().getName()) + " has become a " + F.skill(C.Bold + "Master Assassin"))); + + for (Player player : UtilServer.getPlayers()) + player.playSound(player.getLocation(), Sound.ENDERDRAGON_GROWL, 1f, 1f); + } + else + { + PowerUpType.WEAPON.powerUpPlayer(event.getPlayer(), getRandom()); + PowerUpType.ARMOR.powerUpPlayer(event.getPlayer(), getRandom()); + + UtilPlayer.message(event.getPlayer(), F.main("Game", "Your " + F.item("Sword") + " and " + F.item("Armor") + " have been upgraded!")); + + getGame().Announce(F.main("Game", F.name(event.getPlayer().getName()) + " collected a " + F.skill("Powerup") + ".")); + } + + incrementPowerUpCount(event.getPlayer()); + } + + schedulePowerUpSpawn(10); + } + + @EventHandler + public void onUpdateCompass(UpdateEvent event) + { + if (event.getType() != UpdateType.SEC) + return; + + if (getGame().GetState() != GameState.Live) + return; + + Player[] players = Bukkit.getOnlinePlayers(); + + for (Player player : players) + { + if (!getGame().IsPlaying(player)) + continue; + + if (player.getInventory().contains(Material.COMPASS)) + continue; + + Player closest = null; + double minDistanceSquared = Double.NaN; + + for (Player other : players) + { + if (other == player) + continue; + + if (!getGame().IsPlaying(other)) + continue; + + double distanceSquared = player.getLocation().distanceSquared(other.getLocation()); + + if (closest == null || distanceSquared < minDistanceSquared) { - if (powerUp.powerUpPlayer(event.getPlayer())) - { - powerUp.remove(); - - schedulePowerUpSpawn(10); - } - else - { - _powerUpPickUpCooldown.put(event.getPlayer().getUniqueId(), powerUp); - - Bukkit.getScheduler().runTaskLater(getPlugin(), new Runnable() - { - @Override - public void run() - { - if (_powerUpPickUpCooldown.get(event.getPlayer().getUniqueId()) == powerUp) - _powerUpPickUpCooldown.remove(event.getPlayer().getUniqueId()); - } - }, 40); - } + closest = other; + minDistanceSquared = distanceSquared; } } + + if (closest != null) + player.setCompassTarget(closest.getLocation()); } } - public PowerUp getPowerUpByItem(Item item) + public PowerUpItem getPowerUpByItem(Item item) { if (item == null) return null; - for (PowerUp powerUp : getPowerUps()) + for (PowerUpItem powerUp : getPowerUps()) { if (powerUp.getItem() != null && powerUp.getItem().equals(item)) return powerUp; @@ -197,4 +254,20 @@ public class PowerUpManager implements Listener return null; } + + public int getPowerUpCount(Player player) + { + Integer count = _powerUpCount.get(player.getUniqueId()); + + return count == null ? 0 : count; + } + + public int incrementPowerUpCount(Player player) + { + int count = getPowerUpCount(player) + 1; + + _powerUpCount.put(player.getUniqueId(), count); + + return count; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpType.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpType.java index 8f3de52f4..8d9a69ef2 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpType.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/PowerUpType.java @@ -1,48 +1,26 @@ package nautilus.game.arcade.game.games.sneakyassassins.powerups; import org.bukkit.*; +import org.bukkit.entity.*; + +import java.util.*; public enum PowerUpType { - WEAPON(Material.DIAMOND_SWORD, DyeColor.RED), - ARMOR(Material.IRON_CHESTPLATE, DyeColor.BLUE); + WEAPON(new WeaponPowerUp()), + ARMOR(new ArmorPowerUp()), + SMOKE_BOMB(new SmokeBombPowerUp()), + COMPASS(new CompassPowerUp()); - private final Material _itemType; - private final DyeColor _color; + private final PowerUp _powerUp; - PowerUpType(Material type, DyeColor color) + PowerUpType(PowerUp powerUp) { - _itemType = type; - _color = color; + _powerUp = powerUp; } - public Material getItemType() + public boolean powerUpPlayer(Player player, Random random) { - return _itemType; - } - - public Color getColor() - { - return getDyeColor().getColor(); - } - - public DyeColor getDyeColor() - { - return _color; - } - - public PowerUp spawn(PowerUpManager powerUpManager, Location location) - { - switch (this) - { - case WEAPON: - return new WeaponPowerUp(powerUpManager, location); - - case ARMOR: - return new ArmorPowerUp(powerUpManager, location); - - default: - return null; - } + return _powerUp.powerUpPlayer(player, random); } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/SmokeBombPowerUp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/SmokeBombPowerUp.java new file mode 100644 index 000000000..0d72b1d1a --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/SmokeBombPowerUp.java @@ -0,0 +1,20 @@ +package nautilus.game.arcade.game.games.sneakyassassins.powerups; + +import nautilus.game.arcade.game.games.sneakyassassins.kits.*; +import org.bukkit.entity.*; + +import java.util.*; + +public class SmokeBombPowerUp extends PowerUp +{ + protected SmokeBombPowerUp() + { + super(PowerUpType.SMOKE_BOMB); + } + + @Override + public boolean powerUpPlayer(Player player, Random random) + { + return player.getInventory().addItem(SneakyAssassinKit.SMOKE_BOMB.clone()).isEmpty(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/WeaponPowerUp.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/WeaponPowerUp.java index f19d71608..6eb63ed5e 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/WeaponPowerUp.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/sneakyassassins/powerups/WeaponPowerUp.java @@ -1,6 +1,5 @@ package nautilus.game.arcade.game.games.sneakyassassins.powerups; -import mineplex.core.common.util.*; import org.bukkit.*; import org.bukkit.entity.*; import org.bukkit.inventory.*; @@ -12,18 +11,18 @@ public class WeaponPowerUp extends PowerUp private static final List SWORD_PROGRESSION = Arrays.asList( Material.WOOD_SWORD, Material.STONE_SWORD, - Material.IRON_SWORD, Material.GOLD_SWORD, + Material.IRON_SWORD, Material.DIAMOND_SWORD ); - public WeaponPowerUp(PowerUpManager powerUpManager, Location location) + public WeaponPowerUp() { - super(powerUpManager, PowerUpType.WEAPON, location); + super(PowerUpType.WEAPON); } @Override - public boolean powerUpPlayer(Player player) + public boolean powerUpPlayer(Player player, Random random) { for (int swordType = 0; swordType < SWORD_PROGRESSION.size(); swordType++) { @@ -37,15 +36,11 @@ public class WeaponPowerUp extends PowerUp { player.getInventory().setItem(swordSlot, new ItemStack(SWORD_PROGRESSION.get(newSwordType))); - UtilPlayer.message(player, F.main("Power-Up", "Your " + F.item("Sword") + " was upgraded.")); - - return super.powerUpPlayer(player); + return true; } } } - UtilPlayer.message(player, F.main("Power-Up", "Your " + F.item("Sword") + " is already fully upgraded!")); - return false; } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitArcher.java index 1093e839f..0884e85f7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/spleef/kits/KitArcher.java @@ -16,7 +16,7 @@ public class KitArcher extends Kit { public KitArcher(ArcadeManager manager) { - super(manager, "Archer", KitAvailability.Blue, + super(manager, "Archer", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitSniper.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitSniper.java index f78b0ed16..74c0a9231 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitSniper.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/squidshooter/kits/KitSniper.java @@ -20,7 +20,7 @@ public class KitSniper extends Kit { public KitSniper(ArcadeManager manager) { - super(manager, "Squid Sniper", KitAvailability.Blue, + super(manager, "Squid Sniper", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitAssassin.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitAssassin.java index b1e922912..014daa74d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitAssassin.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitAssassin.java @@ -15,7 +15,7 @@ public class KitAssassin extends Kit { public KitAssassin(ArcadeManager manager) { - super(manager, "Assassin", KitAvailability.Blue, + super(manager, "Assassin", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBeastmaster.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBeastmaster.java index 0aa0ce6f0..c4d0fddaa 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBeastmaster.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBeastmaster.java @@ -15,7 +15,7 @@ public class KitBeastmaster extends Kit { public KitBeastmaster(ArcadeManager manager) { - super(manager, "Beastmaster", KitAvailability.Blue, + super(manager, "Beastmaster", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBomber.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBomber.java index 158379a80..e8ba91f8d 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBomber.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitBomber.java @@ -15,7 +15,7 @@ public class KitBomber extends Kit { public KitBomber(ArcadeManager manager) { - super(manager, "Bomber", KitAvailability.Blue, + super(manager, "Bomber", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitNecromancer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitNecromancer.java index 8835edb4f..5388dafd7 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitNecromancer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/survivalgames/kit/KitNecromancer.java @@ -15,7 +15,7 @@ public class KitNecromancer extends Kit { public KitNecromancer(ArcadeManager manager) { - super(manager, "Necromancer", KitAvailability.Blue, + super(manager, "Necromancer", KitAvailability.Green, 5000, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitShredder.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitShredder.java index a06f57d48..140200ea0 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitShredder.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/turfforts/kits/KitShredder.java @@ -20,7 +20,7 @@ public class KitShredder extends Kit { public KitShredder(ArcadeManager manager) { - super(manager, "Shredder", KitAvailability.Blue, + super(manager, "Shredder", KitAvailability.Green, 5000, new String[] { "Arrows are weaker, but shred through forts." diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorArcher.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorArcher.java index 9cd6f0afb..9668251d4 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorArcher.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/game/games/zombiesurvival/kits/KitSurvivorArcher.java @@ -17,7 +17,7 @@ public class KitSurvivorArcher extends Kit { public KitSurvivorArcher(ArcadeManager manager) { - super(manager, "Survivor Archer", KitAvailability.Blue, + super(manager, "Survivor Archer", KitAvailability.Green, new String[] { diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java index 445431463..feb95bc7c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/Kit.java @@ -1,15 +1,5 @@ package nautilus.game.arcade.kit; -import mineplex.core.common.util.C; -import mineplex.core.common.util.UtilEnt; -import mineplex.core.common.util.UtilInv; -import mineplex.core.common.util.UtilPlayer; -import mineplex.core.common.util.UtilServer; -import nautilus.game.arcade.ArcadeFormat; -import nautilus.game.arcade.ArcadeManager; -import nautilus.game.arcade.events.GameStateChangeEvent; -import nautilus.game.arcade.events.PlayerKitGiveEvent; - import org.bukkit.ChatColor; import org.bukkit.Location; import org.bukkit.Material; @@ -22,6 +12,15 @@ import org.bukkit.entity.Skeleton.SkeletonType; import org.bukkit.event.Listener; import org.bukkit.inventory.ItemStack; +import mineplex.core.common.util.C; +import mineplex.core.common.util.UtilEnt; +import mineplex.core.common.util.UtilInv; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilServer; +import nautilus.game.arcade.ArcadeFormat; +import nautilus.game.arcade.ArcadeManager; +import nautilus.game.arcade.events.PlayerKitGiveEvent; + public abstract class Kit implements Listener { public ArcadeManager Manager; @@ -29,6 +28,7 @@ public abstract class Kit implements Listener private String _kitName; private String[] _kitDesc; private KitAvailability _kitAvailability; + private int _cost; private Perk[] _kitPerks; @@ -36,19 +36,25 @@ public abstract class Kit implements Listener protected ItemStack _itemInHand; protected Material _displayItem; - + public Kit(ArcadeManager manager, String name, KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) + { + this(manager, name, kitAvailability, 2000, kitDesc, kitPerks, entityType, itemInHand); + } + + public Kit(ArcadeManager manager, String name, KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) { Manager = manager; _kitName = name; _kitDesc = kitDesc; _kitPerks = kitPerks; - + for (Perk perk : _kitPerks) perk.SetHost(this); _kitAvailability = kitAvailability; + _cost = cost; _entityType = entityType; _itemInHand = itemInHand; @@ -129,7 +135,7 @@ public abstract class Kit implements Listener LivingEntity entity = (LivingEntity) Manager.GetCreature().SpawnEntity(loc, type); entity.setRemoveWhenFarAway(false); - entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit" + (GetAvailability() == KitAvailability.Blue ? ChatColor.GRAY + " (" + ChatColor.WHITE + "Premium" + ChatColor.GRAY + ")" : "")); + entity.setCustomName(GetAvailability().GetColor() + GetName() + " Kit"); entity.setCustomNameVisible(true); entity.getEquipment().setItemInHand(_itemInHand); @@ -185,7 +191,7 @@ public abstract class Kit implements Listener public int GetCost() { - return 2000; + return _cost; } public Material getDisplayMaterial() @@ -197,5 +203,8 @@ public abstract class Kit implements Listener public void Selected(Player player) { } - + public void setEntityType(EntityType entityType) + { + _entityType = entityType; + } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/KitAvailability.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/KitAvailability.java index 0a6cd960d..18a6cde8c 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/KitAvailability.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/KitAvailability.java @@ -6,7 +6,7 @@ public enum KitAvailability { Free(ChatColor.YELLOW), Green(ChatColor.GREEN), - Blue(ChatColor.AQUA), + //Blue(ChatColor.AQUA), Hide(ChatColor.YELLOW), Null(ChatColor.BLACK); diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/KitSorter.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/KitSorter.java new file mode 100644 index 000000000..bac9d0154 --- /dev/null +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/KitSorter.java @@ -0,0 +1,17 @@ +package nautilus.game.arcade.kit; + +import java.util.Comparator; + +public class KitSorter implements Comparator +{ + @Override + public int compare(Kit kit1, Kit kit2) + { + if (kit1.GetAvailability() == KitAvailability.Free && kit2.GetAvailability() == KitAvailability.Green) + return -1; + else if (kit1.GetAvailability() == KitAvailability.Green && kit2.GetAvailability() == KitAvailability.Free) + return 1; + else + return kit1.GetCost() - kit2.GetCost(); + } +} diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java index d7281c438..4a042e197 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/SmashKit.java @@ -15,7 +15,14 @@ public abstract class SmashKit extends Kit KitAvailability kitAvailability, String[] kitDesc, Perk[] kitPerks, EntityType entityType, ItemStack itemInHand) { - super(manager, name, kitAvailability, kitDesc, kitPerks, entityType, itemInHand); + super(manager, name, kitAvailability, 3000, kitDesc, kitPerks, entityType, itemInHand); + } + + public SmashKit(ArcadeManager manager, String name, + KitAvailability kitAvailability, int cost, String[] kitDesc, Perk[] kitPerks, + EntityType entityType, ItemStack itemInHand) + { + super(manager, name, kitAvailability, cost, kitDesc, kitPerks, entityType, itemInHand); } public void DisplayDesc(Player player) @@ -48,10 +55,4 @@ public abstract class SmashKit extends Kit UtilPlayer.message(player, ArcadeFormat.Line); } - - @Override - public int GetCost() - { - return 3000; - } } diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java index 855cfebab..2169e0a65 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkRevealer.java @@ -13,6 +13,7 @@ import org.bukkit.entity.*; import org.bukkit.event.*; import org.bukkit.event.block.*; import org.bukkit.event.player.*; +import org.bukkit.potion.*; import java.util.*; @@ -125,7 +126,7 @@ public class PerkRevealer extends Perk implements IThrown if (player == data.GetThrower()) continue; - if (player.getLocation().getWorld() == data.GetThrown().getWorld() && player.getLocation().distanceSquared(data.GetThrown().getLocation()) <= 25) + if (player.getLocation().getWorld() == data.GetThrown().getWorld() && player.getLocation().distanceSquared(data.GetThrown().getLocation()) <= 12 * 12) { RevealedPlayerInfo info = getRevealedPlayers().get(player); @@ -135,6 +136,7 @@ public class PerkRevealer extends Perk implements IThrown getRevealedPlayers().put(player, info); Manager.GetDisguise().undisguise(player); + player.addPotionEffect(new PotionEffect(PotionEffectType.WITHER, 100, 0)); } info._expirationSeconds = 5; diff --git a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSmokebomb.java b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSmokebomb.java index fa906a767..c1f890006 100644 --- a/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSmokebomb.java +++ b/Plugins/Nautilus.Game.Arcade/src/nautilus/game/arcade/kit/perks/PerkSmokebomb.java @@ -29,7 +29,7 @@ public class PerkSmokebomb extends Perk private final int effectDuration; private final boolean itemConsumed; - public PerkSmokebomb(Material activatorType, int effectDuration, boolean itemConsumed) + public PerkSmokebomb(Material activatorType, int effectDuration, boolean itemConsumed) { this(activatorType, effectDuration, itemConsumed, C.cYellow + "Right-Click" + C.cGray + " to " + C.cGreen + "Smoke Bomb"); } @@ -62,7 +62,7 @@ public class PerkSmokebomb extends Perk { return itemConsumed; } - + @EventHandler public void Use(PlayerInteractEvent event) { @@ -70,65 +70,53 @@ public class PerkSmokebomb extends Perk if (!Kit.HasKit(player)) return; - + if (!getActivatorTypes().contains(event.getPlayer().getItemInHand().getType())) - return; + return; event.setCancelled(true); - if(isItemConsumed()) + if (isItemConsumed()) { - if(player.getItemInHand().getAmount() > 1) + if (player.getItemInHand().getAmount() > 1) player.getItemInHand().setAmount(player.getItemInHand().getAmount() - 1); else player.setItemInHand(null); } else { - if(!Recharge.Instance.use(player, GetName(), GetName(), 20000, true, true)) + if (!Recharge.Instance.use(player, GetName(), GetName(), 20000, true, true)) return; } + //Inform + UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); + //Action - //Manager.GetCondition().Factory().Cloak(GetName(), player, player, 8, false, false); + Manager.GetCondition().Factory().Cloak(GetName(), player, player, 2, false, false); //Manager.GetCondition().Factory().Vulnerable(GetName(), player, player, 6, 3, false, false, true); //Blind - for (Entity other : player.getNearbyEntities(6, 6, 6)) + for (Entity other : player.getNearbyEntities(5, 5, 5)) { if (other.equals(player) || !(other instanceof LivingEntity)) continue; - - LivingEntity living = (LivingEntity) other; - Manager.GetCondition().Factory().Blind(GetName(), living, player, getEffectDuration(), 0, false, false, true); - Manager.GetCondition().Factory().Slow(GetName(), living, player, getEffectDuration(), 1, false, false, true, false); + if (other instanceof Player) + if (((Player)other).getGameMode() != GameMode.SURVIVAL) + continue; + + LivingEntity living = (LivingEntity) other; + + Manager.GetCondition().Factory().Blind(GetName() + " Effect", living, player, getEffectDuration(), 0, false, false, true); + //Manager.GetCondition().Factory().Slow(GetName() + " Effect", living, player, getEffectDuration(), 0, false, false, true, false); } //Effects player.getWorld().playSound(player.getLocation(), Sound.FIZZ, 2f, 0.5f); UtilParticle.PlayParticle(ParticleType.HUGE_EXPLOSION, player.getLocation(), 0f, 0f, 0f, 0, 1); - - //Inform - UtilPlayer.message(player, F.main("Skill", "You used " + F.skill(GetName()) + ".")); } - @EventHandler(priority = EventPriority.HIGH) - public void EndDamagee(CustomDamageEvent event) - { - if (event.IsCancelled()) - return; - - Player damagee = event.GetDamageePlayer(); - if (damagee == null) return; - - if (!Kit.HasKit(damagee)) - return; - - //End - Manager.GetCondition().EndCondition(damagee, null, GetName()); - } - @EventHandler(priority = EventPriority.HIGH) public void EndDamager(CustomDamageEvent event) { @@ -136,7 +124,7 @@ public class PerkSmokebomb extends Perk return; Player damager = event.GetDamagerPlayer(true); - if (damager == null) return; + if (damager == null) return; if (!Kit.HasKit(damager)) return; @@ -144,15 +132,6 @@ public class PerkSmokebomb extends Perk //End Manager.GetCondition().EndCondition(damager, null, GetName()); } - - @EventHandler - public void EndInteract(PlayerInteractEvent event) - { - if (!Kit.HasKit(event.getPlayer())) - return; - - Manager.GetCondition().EndCondition(event.getPlayer(), null, GetName()); - } @EventHandler public void Smoke(UpdateEvent event) @@ -164,9 +143,9 @@ public class PerkSmokebomb extends Perk { if (!Kit.HasKit(cur)) return; - + Condition cond = Manager.GetCondition().GetActiveCondition(cur, ConditionType.CLOAK); - if (cond == null) continue; + if (cond == null) continue; if (!cond.GetReason().equals(GetName())) continue; @@ -177,7 +156,7 @@ public class PerkSmokebomb extends Perk } @EventHandler - public void Reset(PlayerDeathEvent event) + public void Reset(PlayerDeathEvent event) { //Remove Condition Manager.GetCondition().EndCondition(event.getEntity(), null, GetName()); 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 655b49024..9f9822f23 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 @@ -2,6 +2,8 @@ package nautilus.game.arcade.managers; import java.util.ArrayList; import java.util.Collection; +import java.util.Collections; +import java.util.Comparator; import java.util.HashMap; import java.util.List; import java.util.Map.Entry; @@ -11,10 +13,10 @@ import org.bukkit.ChatColor; import org.bukkit.Color; import org.bukkit.DyeColor; import org.bukkit.FireworkEffect; +import org.bukkit.FireworkEffect.Type; import org.bukkit.Location; import org.bukkit.Material; import org.bukkit.World; -import org.bukkit.FireworkEffect.Type; import org.bukkit.block.Block; import org.bukkit.block.BlockFace; import org.bukkit.entity.Creature; @@ -41,9 +43,9 @@ import mineplex.core.common.util.UtilEnt; import mineplex.core.common.util.UtilInv; import mineplex.core.common.util.UtilServer; import mineplex.core.common.util.UtilText; +import mineplex.core.common.util.UtilText.TextAlign; import mineplex.core.common.util.UtilTime; import mineplex.core.common.util.UtilWorld; -import mineplex.core.common.util.UtilText.TextAlign; import mineplex.core.donation.Donor; import mineplex.core.packethandler.IPacketRunnable; import mineplex.core.packethandler.PacketHandler; @@ -55,14 +57,15 @@ import nautilus.game.arcade.ArcadeManager; import nautilus.game.arcade.GameType; import nautilus.game.arcade.events.GameStateChangeEvent; import nautilus.game.arcade.game.Game; -import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.game.Game.GameState; +import nautilus.game.arcade.game.GameTeam; import nautilus.game.arcade.kit.Kit; import nautilus.game.arcade.kit.KitAvailability; +import nautilus.game.arcade.kit.KitSorter; import net.minecraft.server.v1_7_R3.DataWatcher; import net.minecraft.server.v1_7_R3.Packet; -import net.minecraft.server.v1_7_R3.PacketPlayOutSpawnEntityLiving; import net.minecraft.server.v1_7_R3.PacketPlayOutEntityMetadata; +import net.minecraft.server.v1_7_R3.PacketPlayOutSpawnEntityLiving; import net.minecraft.server.v1_7_R3.WatchableObject; public class GameLobbyManager implements IPacketRunnable, Listener @@ -452,6 +455,9 @@ public class GameLobbyManager implements IPacketRunnable, Listener if (kit.GetAvailability() != KitAvailability.Hide) kits.add(kit); } + + // Sort kits by price + Collections.sort(kits, new KitSorter()); //Smash if (game.GetType() == GameType.Smash || game.GetType() == GameType.SurvivalGames) @@ -464,7 +470,7 @@ public class GameLobbyManager implements IPacketRunnable, Listener for (int i=0 ; i> SpawnLocs = new HashMap>(); private HashMap> DataLocs = new HashMap>(); private HashMap> CustomLocs = new HashMap>(); + private final Map _dataEntries = new HashMap<>(); public WorldData(Game game) { @@ -302,6 +302,10 @@ public class WorldData System.out.println("World Data Read Error: Invalid MaxY [" + tokens[1] + "]"); } } + else + { + _dataEntries.put(tokens[0], tokens[1]); + } } in.close(); @@ -488,4 +492,9 @@ public class WorldData return loc; } + + public String get(String key) + { + return _dataEntries.get(key); + } }