diff --git a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java index 1cabb2dd1..ff803a28b 100644 --- a/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java +++ b/Plugins/Mineplex.Core.Common/src/mineplex/core/common/skin/SkinData.java @@ -63,7 +63,8 @@ public class SkinData public final static SkinData WITCH = new SkinData("eyJ0aW1lc3RhbXAiOjE0NzM5OTEyMTE1NDQsInByb2ZpbGVJZCI6IjlmY2FlZDhiMTRiNTRmN2ZhNjRjYjYwNDBlNzA1MjcyIiwicHJvZmlsZU5hbWUiOiJMQ2FzdHIxIiwic2lnbmF0dXJlUmVxdWlyZWQiOnRydWUsInRleHR1cmVzIjp7IlNLSU4iOnsidXJsIjoiaHR0cDovL3RleHR1cmVzLm1pbmVjcmFmdC5uZXQvdGV4dHVyZS81NDg1ZDZlMTBhNmNmMmY3Mzg2NmZhMGRiNjEzOWQ5NWViZDM0ZGZiMGY0YzAxMmRkM2YzYWYxMWQ5ZjQxYyJ9fX0=", "cojkGLflVWxwnhDXmHMke7crkeA78iUYOWY7H3YvMJFD+VZi9E7vUahLTTx5ELH+PvcaHJerSDmuV+Nasc3K2n6zlXXb0B7RB/ose/kdPxHAIJee7IbZX0iFNDn6irUSOS4wOYF/BwaqG3HmpoSxV52SGMs6kqTer2Rjg3X+XwYFFiDHAR/gwhfXLzrM1iBc171vgu6T+kx65iBHa/YB/V/mj8FSxwM0f5IsLpgAEdxDL9PvEKQWgWeZ1CAqEXlGnjPkd9oGzW0TgDz2MksBbYZ2kmn/S53kK9vCrVB7egZPS4VBtKpq1P7Jeu8rtgjnAKVFQJZ2lMHnVRuvGTd8JKoPHarUPpU2LURUMaCtHzSv9v/4gjkafnDhqxG4TTcr5hxFV+ho72HQchoeaUXzIO+Yo71zrVqkrS0hw6OtgMIBlvaGaEUsFvGiCZePBEiHojO43AKqJcJAVeT2RAzHcAaBAO79ACG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vnYBo1P3A//IGl4gL1Hv8U0I14LT77/AMYH57mItgD0/VnE4bvPIFML/4cX7L9qpdLoOAAyfa5P9cAfzhUnVnRRLM016MpGtvY8SfbZ68Of1Xjz/dZ9/fBEcObXPHGX2QNuJRFiWJjRVKjO7ok0qfiVUEmuZr6I="); + // Comments this out for now, so it doesn't load the player profile // A better way to do this would check for the properties when getting the skull or the skin // Might change on the next version diff --git a/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphLoveDoctor.java b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphLoveDoctor.java new file mode 100644 index 000000000..9f00c7fca --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/gadget/gadgets/morph/MorphLoveDoctor.java @@ -0,0 +1,95 @@ +package mineplex.core.gadget.gadgets.morph; + +import java.util.HashSet; + +import org.bukkit.Bukkit; +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.entity.Player; +import org.bukkit.event.EventHandler; +import org.bukkit.event.block.Action; +import org.bukkit.event.player.PlayerInteractEvent; + +import com.mojang.authlib.GameProfile; + +import mineplex.core.common.skin.SkinData; +import mineplex.core.common.util.F; +import mineplex.core.common.util.LineFormat; +import mineplex.core.common.util.UtilPlayer; +import mineplex.core.common.util.UtilText; +import mineplex.core.disguise.disguises.DisguisePlayer; +import mineplex.core.gadget.GadgetManager; +import mineplex.core.gadget.event.GadgetSelectLocationEvent; +import mineplex.core.gadget.gadgets.morph.managers.UtilMorph; +import mineplex.core.gadget.types.MorphGadget; +import mineplex.core.particleeffects.LoveDoctorEffect; +import mineplex.core.recharge.Recharge; +import mineplex.core.utils.UtilGameProfile; + +public class MorphLoveDoctor extends MorphGadget +{ + + public MorphLoveDoctor(GadgetManager manager) + { + super(manager, "Love Doctor", UtilText.splitLinesToArray(new String[]{"Placeholder"}, LineFormat.LORE), + -17, Material.GLASS, (byte) 0); + } + + @Override + public void enableCustom(Player player, boolean message) + { + applyArmor(player, message); + + GameProfile gameProfile = UtilGameProfile.getGameProfile(player); + gameProfile.getProperties().clear(); + gameProfile.getProperties().put("textures", SkinData.LOVE_DOCTOR.getProperty()); + + DisguisePlayer disguisePlayer = new DisguisePlayer(player, gameProfile); + disguisePlayer.showInTabList(true, 0); + UtilMorph.disguise(player, disguisePlayer, Manager); + } + + @Override + public void disableCustom(Player player, boolean message) + { + removeArmor(player); + + UtilMorph.undisguise(player, Manager.getDisguiseManager()); + } + + @EventHandler + public void onRightClick(PlayerInteractEvent event) + { + if (!isActive(event.getPlayer())) + return; + + if (event.getAction() != Action.RIGHT_CLICK_AIR) + return; + + Player player = event.getPlayer(); + + if (!Recharge.Instance.use(player, "Love Doctor Laser", 5000, true, false, "Cosmetics")) + return; + + HashSet ignore = new HashSet(); + ignore.add(Material.AIR); + Location loc = player.getTargetBlock(ignore, 64).getLocation().add(0.5, 0.5, 0.5); + + GadgetSelectLocationEvent gadgetSelectLocationEvent = new GadgetSelectLocationEvent(player, this, loc); + Bukkit.getServer().getPluginManager().callEvent(gadgetSelectLocationEvent); + + // Checks to see if it's a valid location + if (gadgetSelectLocationEvent.isCancelled()) + { + if (gadgetSelectLocationEvent.canShowMessage()) + { + UtilPlayer.message(player, F.main("Gadget", "You cannot use the laser on this area!")); + } + + return; + } + LoveDoctorEffect loveDoctorEffect = new LoveDoctorEffect(player, loc, this); + loveDoctorEffect.start(); + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/LoveDoctorEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/LoveDoctorEffect.java new file mode 100644 index 000000000..60bc1680f --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/LoveDoctorEffect.java @@ -0,0 +1,106 @@ +package mineplex.core.particleeffects; + +import java.util.HashMap; +import java.util.HashSet; + +import org.bukkit.Location; +import org.bukkit.Material; +import org.bukkit.Sound; +import org.bukkit.entity.Player; +import org.bukkit.util.Vector; + +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.UtilServer; +import mineplex.core.gadget.types.Gadget; + +public class LoveDoctorEffect extends Effect +{ + + private int _particles = 100; + private int _count = 0; + private Vector _vector; + private Location _fixedLoc; + private Gadget _gadget; + private Player _player; + private boolean _forceStop = false; + + public LoveDoctorEffect(Player player, Location target, Gadget gadget) + { + super(-1, new EffectLocation(player), gadget.Manager.getPlugin()); + _gadget = gadget; + _player = player; + setTargetLocation(new EffectLocation(target)); + } + + @Override + public void onStart() + { + _player.getWorld().playSound(_player.getLocation(), Sound.PISTON_RETRACT, 1f, 1f); + } + + @Override + public void runEffect() + { + Location location = _effectLocation.getFixedLocation().clone().add(0, 1, 0); + if (_vector == null) + { + Location targetLoc = getTargetLocation().getFixedLocation().clone(); + Vector link = targetLoc.toVector().subtract(location.toVector()); + float length = (float) link.length(); + link.normalize(); + Vector vector = link.multiply(length / _particles); + _vector = vector; + _fixedLoc = location.clone().subtract(_vector); + } + for (int i = 0; i < 5; i++){ + _fixedLoc.add(_vector); + UtilParticle.PlayParticle(UtilParticle.ParticleType.HEART, _fixedLoc, 0, 0, 0, 0, 2, UtilParticle.ViewDist.LONG); + } + if (_fixedLoc.getBlock().getType() != Material.AIR ) + { + stop(); + } + else if (_count >= 1000) + { + _forceStop = true; + stop(); + } + _count += 5; + } + + @Override + public void onStop() + { + if (!_forceStop) + { + _count = 0; + _vector = null; + HashSet ignore = new HashSet(); + ignore.add(Material.AIR); + Location loc = _player.getTargetBlock(ignore, 64).getLocation().add(0.5, 0.5, 0.5); + _effectLocation = new EffectLocation(_player); + setTargetLocation(new EffectLocation(loc)); + } + // Creates the explosion and knockback players + Location loc = _fixedLoc; + loc.getWorld().createExplosion(loc, 0f); + UtilParticle.PlayParticle(UtilParticle.ParticleType.EXPLODE, loc, 3f, 3f, 3f, 0, 32, UtilParticle.ViewDist.MAX, UtilServer.getPlayers()); + HashMap players = UtilPlayer.getInRadius(loc, 9d); + for (Player ent : players.keySet()) + { + if (_gadget.Manager.collideEvent(_player, _gadget, ent)) + continue; + + double mult = players.get(ent); + + //Knockback + UtilAction.velocity(ent, UtilAlg.getTrajectory(loc, ent.getLocation()), 2 * mult, false, 0, 1 + 1 * mult, 10, true); + LoveDoctorHitEffect loveDoctorHitEffect = new LoveDoctorHitEffect(ent); + loveDoctorHitEffect.start(); + } + } + +} diff --git a/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/LoveDoctorHitEffect.java b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/LoveDoctorHitEffect.java new file mode 100644 index 000000000..5b7678fa1 --- /dev/null +++ b/Plugins/Mineplex.Core/src/mineplex/core/particleeffects/LoveDoctorHitEffect.java @@ -0,0 +1,24 @@ +package mineplex.core.particleeffects; + +import org.bukkit.Location; +import org.bukkit.entity.Player; + +import mineplex.core.common.util.UtilParticle; +import mineplex.core.common.util.UtilServer; + +public class LoveDoctorHitEffect extends Effect +{ + + public LoveDoctorHitEffect(Player player) + { + super(200, new EffectLocation(player.getLocation()), UtilServer.getPlugin()); + } + + @Override + public void runEffect() + { + Location location = getEffectLocation().getLocation(); + UtilParticle.PlayParticle(UtilParticle.ParticleType.HEART, location.clone().add(0, 1, 0), 0.75f, 0.75f, 0.75f, 0, 1, UtilParticle.ViewDist.NORMAL); + } + +}