Changed rabbit morph to spawn holograms
This commit is contained in:
parent
32bb2515f7
commit
3c241c48bc
@ -1,24 +1,15 @@
|
|||||||
package mineplex.core.gadget.gadgets.morph;
|
package mineplex.core.gadget.gadgets.morph;
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import org.bukkit.Material;
|
import org.bukkit.Material;
|
||||||
import org.bukkit.entity.Bat;
|
|
||||||
import org.bukkit.entity.Player;
|
import org.bukkit.entity.Player;
|
||||||
import org.bukkit.entity.Skeleton;
|
|
||||||
import org.bukkit.entity.Slime;
|
|
||||||
import org.bukkit.event.EventHandler;
|
import org.bukkit.event.EventHandler;
|
||||||
import org.bukkit.potion.PotionEffect;
|
import org.bukkit.event.player.PlayerToggleSneakEvent;
|
||||||
import org.bukkit.potion.PotionEffectType;
|
|
||||||
import org.spigotmc.event.entity.EntityDismountEvent;
|
|
||||||
|
|
||||||
import com.mojang.authlib.GameProfile;
|
import com.mojang.authlib.GameProfile;
|
||||||
|
|
||||||
import mineplex.core.common.skin.SkinData;
|
import mineplex.core.common.skin.SkinData;
|
||||||
import mineplex.core.common.util.C;
|
import mineplex.core.common.util.C;
|
||||||
import mineplex.core.common.util.LineFormat;
|
import mineplex.core.common.util.LineFormat;
|
||||||
import mineplex.core.common.util.UtilEnt;
|
|
||||||
import mineplex.core.common.util.UtilText;
|
import mineplex.core.common.util.UtilText;
|
||||||
import mineplex.core.disguise.disguises.DisguisePlayer;
|
import mineplex.core.disguise.disguises.DisguisePlayer;
|
||||||
import mineplex.core.gadget.GadgetManager;
|
import mineplex.core.gadget.GadgetManager;
|
||||||
@ -29,10 +20,6 @@ import mineplex.core.utils.UtilGameProfile;
|
|||||||
public class MorphAwkwardRabbit extends MorphGadget
|
public class MorphAwkwardRabbit extends MorphGadget
|
||||||
{
|
{
|
||||||
|
|
||||||
private Map<Player, Skeleton> _skeletons = new HashMap<>();
|
|
||||||
private Map<Player, Slime> _slimes = new HashMap<>();
|
|
||||||
private Map<Player, Bat> _bats = new HashMap<>();
|
|
||||||
|
|
||||||
public MorphAwkwardRabbit(GadgetManager manager)
|
public MorphAwkwardRabbit(GadgetManager manager)
|
||||||
{
|
{
|
||||||
super(manager, "Awkward Rabbit Morph", UtilText.splitLinesToArray(new String[]{C.cGray + "Dale was the most awkward of Rabbits."}, LineFormat.LORE),
|
super(manager, "Awkward Rabbit Morph", UtilText.splitLinesToArray(new String[]{C.cGray + "Dale was the most awkward of Rabbits."}, LineFormat.LORE),
|
||||||
@ -44,26 +31,6 @@ public class MorphAwkwardRabbit extends MorphGadget
|
|||||||
{
|
{
|
||||||
applyArmor(player, message);
|
applyArmor(player, message);
|
||||||
|
|
||||||
Manager.getPetManager().getCreatureModule().SetForce(true);
|
|
||||||
|
|
||||||
Slime slime = player.getWorld().spawn(player.getLocation(), Slime.class);
|
|
||||||
UtilEnt.silence(slime, true);
|
|
||||||
slime.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false));
|
|
||||||
slime.setSize(-2);
|
|
||||||
|
|
||||||
Skeleton skeleton = player.getWorld().spawn(player.getLocation(), Skeleton.class);
|
|
||||||
UtilEnt.silence(skeleton, true);
|
|
||||||
skeleton.setCustomName("Dinnerbone");
|
|
||||||
skeleton.setCustomNameVisible(false);
|
|
||||||
skeleton.addPotionEffect(new PotionEffect(PotionEffectType.SLOW, Integer.MAX_VALUE, 1, false, false));
|
|
||||||
skeleton.getEquipment().setHelmet(SkinData.SLENDERMAN.getSkull());
|
|
||||||
|
|
||||||
Bat bat = player.getWorld().spawn(player.getLocation(), Bat.class);
|
|
||||||
UtilEnt.silence(bat, true);
|
|
||||||
bat.addPotionEffect(new PotionEffect(PotionEffectType.INVISIBILITY, Integer.MAX_VALUE, 1, false, false));
|
|
||||||
|
|
||||||
Manager.getPetManager().getCreatureModule().SetForce(false);
|
|
||||||
|
|
||||||
GameProfile gameProfile = UtilGameProfile.getGameProfile(player);
|
GameProfile gameProfile = UtilGameProfile.getGameProfile(player);
|
||||||
gameProfile.getProperties().clear();
|
gameProfile.getProperties().clear();
|
||||||
gameProfile.getProperties().put("textures", SkinData.BUGS_BUNNY.getProperty());
|
gameProfile.getProperties().put("textures", SkinData.BUGS_BUNNY.getProperty());
|
||||||
@ -71,14 +38,6 @@ public class MorphAwkwardRabbit extends MorphGadget
|
|||||||
DisguisePlayer disguisePlayer = new DisguisePlayer(player, gameProfile);
|
DisguisePlayer disguisePlayer = new DisguisePlayer(player, gameProfile);
|
||||||
disguisePlayer.showInTabList(true, 0);
|
disguisePlayer.showInTabList(true, 0);
|
||||||
UtilMorph.disguise(player, disguisePlayer, Manager);
|
UtilMorph.disguise(player, disguisePlayer, Manager);
|
||||||
|
|
||||||
_skeletons.put(player, skeleton);
|
|
||||||
_slimes.put(player, slime);
|
|
||||||
_bats.put(player, bat);
|
|
||||||
|
|
||||||
skeleton.setPassenger(bat);
|
|
||||||
slime.setPassenger(skeleton);
|
|
||||||
disguisePlayer.getEntity().getBukkitEntity().setPassenger(slime);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@ -86,35 +45,18 @@ public class MorphAwkwardRabbit extends MorphGadget
|
|||||||
{
|
{
|
||||||
removeArmor(player);
|
removeArmor(player);
|
||||||
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
UtilMorph.undisguise(player, Manager.getDisguiseManager());
|
||||||
_skeletons.get(player).remove();
|
|
||||||
_slimes.get(player).remove();
|
|
||||||
_bats.get(player).remove();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventHandler
|
@EventHandler
|
||||||
public void dismount(EntityDismountEvent event)
|
public void spawnHolograms(PlayerToggleSneakEvent event)
|
||||||
{
|
{
|
||||||
if (event.getDismounted() instanceof Skeleton)
|
if (!isActive(event.getPlayer()))
|
||||||
{
|
return;
|
||||||
if (_skeletons.containsValue(event.getDismounted()))
|
|
||||||
{
|
if (event.isSneaking())
|
||||||
event.setCancelled(true);
|
return;
|
||||||
}
|
|
||||||
}
|
|
||||||
if (event.getDismounted() instanceof Slime)
|
|
||||||
{
|
|
||||||
if (_slimes.containsValue(event.getDismounted()))
|
|
||||||
{
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (event.getDismounted() instanceof Bat)
|
|
||||||
{
|
|
||||||
if (_bats.containsValue(event.getDismounted()))
|
|
||||||
{
|
|
||||||
event.setCancelled(true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user